~ihabunek/triglav

ref: d1b5915f3e023d04850eabf702bda7207a337302 triglav/priv/repo/migrations/20210227082725_create_public_transport_tables.exs -rw-r--r-- 1015 bytes
d1b5915fIvan Habunek Validate platform distance from route 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
defmodule Triglav.Repo.Migrations.CreatePublicTransportTables do
  use Ecto.Migration

  def up do
    create table("public_transport_trips", primary_key: false) do
      add :relation_id, :bigint, null: false, primary_key: true
      add :route_id, :string
      add :geometry, :geometry, null: false
      add :exact, :boolean, null: false
      add :stop_ids, {:array, :string}
    end

    create table("public_transport_platforms", primary_key: false) do
      add :relation_id, :bigint, null: false, primary_key: true
      add :route_id, :string
      add :stop_id, :string
      add :node_id, :bigint
      add :way_id, :bigint
      add :sequence_id, :integer, null: false, primary_key: true
      add :geometry, :geometry, null: false
    end

    create index("public_transport_trips", [:geometry], using: :gist)
    create index("public_transport_platforms", [:geometry], using: :gist)
  end

  def down do
    drop table("public_transport_trips")
    drop table("public_transport_platforms")
  end
end