-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into jz-import-gtfs-endpoint--ecto-schemas
- Loading branch information
Showing
29 changed files
with
593 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
defmodule Arrow.Shuttles.Route do | ||
@moduledoc "schema for a shuttle route for the db" | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
schema "shuttle_routes" do | ||
field :suffix, :string | ||
field :destination, :string | ||
field :direction_id, Ecto.Enum, values: [:"0", :"1"] | ||
field :direction_desc, :string | ||
field :waypoint, :string | ||
field :shuttle_id, :id | ||
field :shape_id, :id | ||
|
||
timestamps(type: :utc_datetime) | ||
end | ||
|
||
@doc false | ||
def changeset(route, attrs) do | ||
route | ||
|> cast(attrs, [:direction_id, :direction_desc, :destination, :waypoint, :suffix]) | ||
|> validate_required([:direction_id, :direction_desc, :destination]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule Arrow.Shuttles.RouteStop do | ||
@moduledoc "schema for a shuttle route stop for the db" | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
schema "shuttle_route_stops" do | ||
field :direction_id, Ecto.Enum, values: [:"0", :"1"] | ||
field :stop_id, :string | ||
field :stop_sequence, :integer | ||
field :time_to_next_stop, :decimal | ||
field :shuttle_route_id, :id | ||
|
||
timestamps(type: :utc_datetime) | ||
end | ||
|
||
@doc false | ||
def changeset(route_stop, attrs) do | ||
route_stop | ||
|> cast(attrs, [:direction_id, :stop_id, :stop_sequence, :time_to_next_stop]) | ||
|> validate_required([:direction_id, :stop_id, :stop_sequence, :time_to_next_stop]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
lib/arrow/shuttle/shape_kml.ex → lib/arrow/shuttles/shape_kml.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
lib/arrow/shuttle/shape_upload.ex → lib/arrow/shuttles/shape_upload.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule Arrow.Shuttles.Shuttle do | ||
@moduledoc "schema for a shuttle for the db" | ||
use Ecto.Schema | ||
import Ecto.Changeset | ||
|
||
schema "shuttles" do | ||
field :status, Ecto.Enum, values: [:draft, :active, :inactive] | ||
field :shuttle_name, :string | ||
field :disrupted_route_id, :string | ||
|
||
timestamps(type: :utc_datetime) | ||
end | ||
|
||
@doc false | ||
def changeset(shuttle, attrs) do | ||
shuttle | ||
|> cast(attrs, [:shuttle_name, :disrupted_route_id, :status]) | ||
|> validate_required([:shuttle_name, :disrupted_route_id, :status]) | ||
|> unique_constraint(:shuttle_name) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
defmodule Arrow.Shuttle.Stop do | ||
defmodule Arrow.Shuttles.Stop do | ||
@moduledoc false | ||
|
||
use Ecto.Schema | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
defmodule Arrow.Repo.Migrations.CreateShuttles do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:shuttles) do | ||
add :shuttle_name, :string | ||
add :disrupted_route_id, :string | ||
# add :disrupted_route_id, references(:gtfs_routes, type: :varchar, on_delete: :nothing) | ||
add :status, :string | ||
|
||
timestamps(type: :timestamptz) | ||
end | ||
|
||
create unique_index(:shuttles, [:shuttle_name]) | ||
end | ||
end |
20 changes: 20 additions & 0 deletions
20
priv/repo/migrations/20241010164455_create_shuttle_routes.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
defmodule Arrow.Repo.Migrations.CreateShuttleRoutes do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:shuttle_routes) do | ||
add :direction_id, :string | ||
add :direction_desc, :string | ||
add :destination, :string | ||
add :waypoint, :string | ||
add :suffix, :string | ||
add :shuttle_id, references(:shuttles, on_delete: :nothing) | ||
add :shape_id, references(:shapes, on_delete: :nothing) | ||
|
||
timestamps(type: :timestamptz) | ||
end | ||
|
||
create index(:shuttle_routes, [:shuttle_id]) | ||
create index(:shuttle_routes, [:shape_id]) | ||
end | ||
end |
17 changes: 17 additions & 0 deletions
17
priv/repo/migrations/20241010164555_create_shuttle_route_stops.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
defmodule Arrow.Repo.Migrations.CreateShuttleRouteStops do | ||
use Ecto.Migration | ||
|
||
def change do | ||
create table(:shuttle_route_stops) do | ||
add :direction_id, :string | ||
add :stop_id, :string | ||
add :stop_sequence, :integer | ||
add :time_to_next_stop, :decimal | ||
add :shuttle_route_id, references(:shuttle_routes, on_delete: :nothing) | ||
|
||
timestamps(type: :timestamptz) | ||
end | ||
|
||
create index(:shuttle_route_stops, [:shuttle_route_id]) | ||
end | ||
end |
Oops, something went wrong.