Remove last occurences of address_type

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-01-14 18:12:52 +01:00
parent 289ba03960
commit 3230381be4
4 changed files with 117 additions and 125 deletions

View File

@@ -2,9 +2,7 @@ defmodule Mobilizon.Repo.Migrations.AddAddressType do
use Ecto.Migration
def up do
Mobilizon.Events.AddressTypeEnum.create_type
alter table(:events) do
add :address_type, :address_type
add :online_address, :string
add :phone, :string
end
@@ -17,11 +15,9 @@ defmodule Mobilizon.Repo.Migrations.AddAddressType do
def down do
alter table(:events) do
remove :address_type
remove :online_address
remove :phone
end
Mobilizon.Events.AddressTypeEnum.drop_type
drop constraint(:events, "events_physical_address_id_fkey")
rename table(:events), :physical_address_id, to: :address_id
alter table(:events) do

View File

@@ -1,11 +1,10 @@
defmodule Mobilizon.Repo.Migrations.RemoveAddressType do
use Ecto.Migration
require Logger
def up do
alter table(:events) do
remove(:address_type)
end
execute "DROP TYPE address_type"
execute "DROP TYPE IF EXISTS address_type"
execute "ALTER TABLE \"events\" DROP COLUMN IF EXISTS address_type"
rename table(:events), :phone, to: :phone_address
end
end