2019-01-14 14:56:07 +00:00
|
|
|
defmodule Mobilizon.Repo.Migrations.FixEventVisibility do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def up do
|
2019-02-22 13:18:52 +00:00
|
|
|
Mobilizon.Events.EventVisibilityEnum.create_type()
|
|
|
|
Mobilizon.Events.EventStatusEnum.create_type()
|
|
|
|
Mobilizon.Events.CommentVisibilityEnum.create_type()
|
|
|
|
|
2019-01-14 14:56:07 +00:00
|
|
|
alter table(:events) do
|
|
|
|
remove(:public)
|
|
|
|
remove(:status)
|
|
|
|
remove(:state)
|
|
|
|
add(:visibility, Mobilizon.Events.EventVisibilityEnum.type())
|
|
|
|
add(:status, Mobilizon.Events.EventStatusEnum.type())
|
|
|
|
end
|
2019-01-14 15:21:13 +00:00
|
|
|
|
|
|
|
alter table(:comments) do
|
|
|
|
add(:visibility, Mobilizon.Events.CommentVisibilityEnum.type())
|
|
|
|
end
|
2019-01-14 14:56:07 +00: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 13:18:52 +00:00
|
|
|
|
2019-01-14 15:21:13 +00:00
|
|
|
alter table(:comments) do
|
|
|
|
remove(:visibility)
|
|
|
|
end
|
2019-02-22 13:18:52 +00:00
|
|
|
|
|
|
|
Mobilizon.Events.EventVisibilityEnum.drop_type()
|
|
|
|
Mobilizon.Events.EventStatusEnum.drop_type()
|
|
|
|
Mobilizon.Events.CommentVisibilityEnum.drop_type()
|
2019-01-14 14:56:07 +00:00
|
|
|
end
|
|
|
|
end
|