Add adresses

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-01-17 11:39:01 +01:00
parent bfcdc38076
commit 07382d6aca
19 changed files with 551 additions and 42 deletions

View File

@@ -0,0 +1,19 @@
defmodule Eventos.Repo.Migrations.CreateAddresses do
use Ecto.Migration
def change do
create table(:addresses) do
add :description, :string
add :floor, :string
add :addressCountry, :string
add :addressLocality, :string
add :addressRegion, :string
add :postalCode, :string
add :streetAddress, :string
add :geom, :geometry
timestamps()
end
end
end

View File

@@ -9,6 +9,7 @@ defmodule Eventos.Repo.Migrations.CreateGroups do
add :suspended, :boolean, default: false, null: false
add :url, :string
add :uri, :string
add :address_id, references(:addresses, on_delete: :delete_all)
timestamps()
end

View File

@@ -8,7 +8,6 @@ defmodule Eventos.Repo.Migrations.CreateEvents do
add :description, :string, null: true
add :begins_on, :datetimetz
add :ends_on, :datetimetz
add :geom, :geometry
add :state, :integer, null: false
add :public, :boolean, null: false
add :status, :integer, null: false
@@ -18,6 +17,7 @@ defmodule Eventos.Repo.Migrations.CreateEvents do
add :organizer_account_id, references(:accounts, on_delete: :nothing)
add :organizer_group_id, references(:groups, on_delete: :nothing)
add :category_id, references(:categories, on_delete: :nothing), null: false
add :address_id, references(:addresses, on_delete: :delete_all)
timestamps()
end