forked from potsda.mn/mobilizon
Set visibility field default to null
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
a2070b1d54
commit
1b3ee17d72
|
@ -5,6 +5,8 @@ defmodule Mobilizon.Repo.Migrations.SplitEventVisibilityAndJoinOptions do
|
|||
|
||||
@doc """
|
||||
EventVisibilityEnum has dropped some possible values, so we need to recreate it
|
||||
|
||||
Visibility allowed nullable values previously
|
||||
"""
|
||||
def up do
|
||||
execute "ALTER TABLE events ALTER COLUMN visibility TYPE VARCHAR USING visibility::text"
|
||||
|
@ -16,6 +18,12 @@ defmodule Mobilizon.Repo.Migrations.SplitEventVisibilityAndJoinOptions do
|
|||
alter table(:events) do
|
||||
add(:join_options, JoinOptionsEnum.type(), null: false, default: "free")
|
||||
end
|
||||
|
||||
execute "UPDATE events SET visibility = 'public' WHERE visibility IS NULL"
|
||||
|
||||
alter table(:events) do
|
||||
modify(:visibility, EventVisibilityEnum.type(), null: false, default: "public")
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
|
|
Loading…
Reference in a new issue