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 """
|
@doc """
|
||||||
EventVisibilityEnum has dropped some possible values, so we need to recreate it
|
EventVisibilityEnum has dropped some possible values, so we need to recreate it
|
||||||
|
|
||||||
|
Visibility allowed nullable values previously
|
||||||
"""
|
"""
|
||||||
def up do
|
def up do
|
||||||
execute "ALTER TABLE events ALTER COLUMN visibility TYPE VARCHAR USING visibility::text"
|
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
|
alter table(:events) do
|
||||||
add(:join_options, JoinOptionsEnum.type(), null: false, default: "free")
|
add(:join_options, JoinOptionsEnum.type(), null: false, default: "free")
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
def down do
|
def down do
|
||||||
|
|
Loading…
Reference in a new issue