Skip to content

Commit

Permalink
Create Chateau sql model
Browse files Browse the repository at this point in the history
  • Loading branch information
kylerchin committed Mar 27, 2024
1 parent 7b50f3d commit ebdc11b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
6 changes: 3 additions & 3 deletions migrations/2024-03-26-004608_init/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ CREATE INDEX static_hulls ON gtfs.static_feeds USING GIST (hull);

CREATE TABLE gtfs.chateaus (
chateau text NOT NULL PRIMARY KEY,
static_feeds text[],
realtime_feeds text[],
languages_avaliable text[],
static_feeds text[] NOT NULL,
realtime_feeds text[] NOT NULL,
languages_avaliable text[] NOT NULL,
hull GEOMETRY(POLYGON,4326)
);

Expand Down
11 changes: 11 additions & 0 deletions src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,14 @@ pub struct StaticDownloadAttempt {
pub mark_for_redo: bool,
pub http_response_code: Option<String>,
}

#[derive(Queryable, Selectable, Insertable, Debug, Clone)]
#[diesel(table_name = crate::schema::gtfs::chateaus)]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct Chateau {
pub chateau: String,
pub static_feeds: Vec<Option<String>>,
pub realtime_feeds: Vec<Option<String>>,
pub languages_avaliable: Vec<Option<String>>,
pub hull: Option<postgis_diesel::types::Polygon<postgis_diesel::types::Point>>,
}
6 changes: 3 additions & 3 deletions src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ pub mod gtfs {

gtfs.chateaus (chateau) {
chateau -> Text,
static_feeds -> Nullable<Array<Nullable<Text>>>,
realtime_feeds -> Nullable<Array<Nullable<Text>>>,
languages_avaliable -> Nullable<Array<Nullable<Text>>>,
static_feeds -> Array<Nullable<Text>>,
realtime_feeds -> Array<Nullable<Text>>,
languages_avaliable -> Array<Nullable<Text>>,
hull -> Nullable<Geometry>,
}
}
Expand Down

0 comments on commit ebdc11b

Please sign in to comment.