2019-02-14 14:19:55 +01:00
|
|
|
defmodule Mobilizon.Repo.Migrations.DropDatetimetz do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def up do
|
|
|
|
alter table(:events) do
|
|
|
|
remove(:begins_on)
|
|
|
|
remove(:ends_on)
|
|
|
|
remove(:publish_at)
|
|
|
|
add(:begins_on, :utc_datetime)
|
|
|
|
add(:ends_on, :utc_datetime)
|
|
|
|
add(:publish_at, :utc_datetime)
|
|
|
|
end
|
|
|
|
|
|
|
|
alter table(:sessions) do
|
|
|
|
remove(:begins_on)
|
|
|
|
remove(:ends_on)
|
|
|
|
add(:begins_on, :utc_datetime)
|
|
|
|
add(:ends_on, :utc_datetime)
|
|
|
|
end
|
|
|
|
|
2019-02-22 14:18:52 +01:00
|
|
|
execute("DROP TYPE datetimetz")
|
2019-02-14 14:19:55 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
|
|
|
execute("""
|
|
|
|
CREATE TYPE datetimetz AS (
|
|
|
|
dt timestamptz,
|
|
|
|
tz varchar
|
|
|
|
);
|
|
|
|
""")
|
|
|
|
|
|
|
|
alter table(:events) do
|
|
|
|
remove(:begins_on)
|
|
|
|
remove(:ends_on)
|
|
|
|
remove(:publish_at)
|
|
|
|
add(:begins_on, :datetimetz)
|
|
|
|
add(:ends_on, :datetimetz)
|
|
|
|
add(:publish_at, :datetimetz)
|
|
|
|
end
|
|
|
|
|
|
|
|
alter table(:sessions) do
|
|
|
|
remove(:begins_on)
|
|
|
|
remove(:ends_on)
|
|
|
|
add(:begins_on, :datetimetz)
|
|
|
|
add(:ends_on, :datetimetz)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|