2019-01-14 15:56:07 +01:00
|
|
|
defmodule Mobilizon.Repo.Migrations.FixEventVisibility do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def up do
|
2019-09-13 01:01:17 +02:00
|
|
|
Mobilizon.Events.EventVisibility.create_type()
|
|
|
|
Mobilizon.Events.EventStatus.create_type()
|
|
|
|
Mobilizon.Events.CommentVisibility.create_type()
|
2019-02-22 14:18:52 +01:00
|
|
|
|
2019-01-14 15:56:07 +01:00
|
|
|
alter table(:events) do
|
|
|
|
remove(:public)
|
|
|
|
remove(:status)
|
|
|
|
remove(:state)
|
2019-09-13 01:01:17 +02:00
|
|
|
add(:visibility, Mobilizon.Events.EventVisibility.type())
|
|
|
|
add(:status, Mobilizon.Events.EventStatus.type())
|
2019-01-14 15:56:07 +01:00
|
|
|
end
|
2019-01-14 16:21:13 +01:00
|
|
|
|
|
|
|
alter table(:comments) do
|
2019-09-13 01:01:17 +02:00
|
|
|
add(:visibility, Mobilizon.Events.CommentVisibility.type())
|
2019-01-14 16:21:13 +01:00
|
|
|
end
|
2019-01-14 15:56:07 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
|
|
|
alter table(:events) do
|
|
|
|
remove(:visibility)
|
|
|
|
remove(:status)
|
|
|
|
add(:state, :integer, null: false, default: 0)
|
|
|
|
add(:public, :boolean, null: false, default: false)
|
|
|
|
add(:status, :integer, null: false, default: 0)
|
|
|
|
end
|
2019-02-22 14:18:52 +01:00
|
|
|
|
2019-01-14 16:21:13 +01:00
|
|
|
alter table(:comments) do
|
|
|
|
remove(:visibility)
|
|
|
|
end
|
2019-02-22 14:18:52 +01:00
|
|
|
|
2019-09-13 01:01:17 +02:00
|
|
|
Mobilizon.Events.EventVisibility.drop_type()
|
|
|
|
Mobilizon.Events.EventStatus.drop_type()
|
|
|
|
Mobilizon.Events.CommentVisibility.drop_type()
|
2019-01-14 15:56:07 +01:00
|
|
|
end
|
|
|
|
end
|