Fix mix format and format migrations too
Signed-off-by: Thomas Citharel <tcit@tcit.fr> Fix credo warnings Signed-off-by: Thomas Citharel <tcit@tcit.fr> Show elixir version Signed-off-by: Thomas Citharel <tcit@tcit.fr> Also lint migrations Signed-off-by: Thomas Citharel <tcit@tcit.fr> Reset allow failure to false Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -9,16 +9,17 @@ defmodule Mobilizon.Repo.Migrations.MoveParticipantRoleToEnum do
|
||||
add(:role_tmp, ParticipantRoleEnum.type(), default: "participant")
|
||||
end
|
||||
|
||||
execute "UPDATE participants set role_tmp = 'not_approved' where role = 0"
|
||||
execute "UPDATE participants set role_tmp = 'participant' where role = 1"
|
||||
execute "UPDATE participants set role_tmp = 'moderator' where role = 2"
|
||||
execute "UPDATE participants set role_tmp = 'administrator' where role = 3"
|
||||
execute "UPDATE participants set role_tmp = 'creator' where role = 4"
|
||||
execute("UPDATE participants set role_tmp = 'not_approved' where role = 0")
|
||||
execute("UPDATE participants set role_tmp = 'participant' where role = 1")
|
||||
execute("UPDATE participants set role_tmp = 'moderator' where role = 2")
|
||||
execute("UPDATE participants set role_tmp = 'administrator' where role = 3")
|
||||
execute("UPDATE participants set role_tmp = 'creator' where role = 4")
|
||||
|
||||
alter table(:participants) do
|
||||
remove(:role)
|
||||
end
|
||||
rename table(:participants), :role_tmp, to: :role
|
||||
|
||||
rename(table(:participants), :role_tmp, to: :role)
|
||||
end
|
||||
|
||||
def down do
|
||||
@@ -26,17 +27,18 @@ defmodule Mobilizon.Repo.Migrations.MoveParticipantRoleToEnum do
|
||||
add(:role_tmp, :integer, default: 1)
|
||||
end
|
||||
|
||||
execute "UPDATE participants set role_tmp = 0 where role = 'not_approved'"
|
||||
execute "UPDATE participants set role_tmp = 1 where role = 'participant'"
|
||||
execute "UPDATE participants set role_tmp = 2 where role = 'moderator'"
|
||||
execute "UPDATE participants set role_tmp = 3 where role = 'administrator'"
|
||||
execute "UPDATE participants set role_tmp = 4 where role = 'creator'"
|
||||
execute("UPDATE participants set role_tmp = 0 where role = 'not_approved'")
|
||||
execute("UPDATE participants set role_tmp = 1 where role = 'participant'")
|
||||
execute("UPDATE participants set role_tmp = 2 where role = 'moderator'")
|
||||
execute("UPDATE participants set role_tmp = 3 where role = 'administrator'")
|
||||
execute("UPDATE participants set role_tmp = 4 where role = 'creator'")
|
||||
|
||||
alter table(:participants) do
|
||||
remove(:role)
|
||||
end
|
||||
|
||||
ParticipantRoleEnum.drop_type()
|
||||
|
||||
rename table(:participants), :role_tmp, to: :role
|
||||
rename(table(:participants), :role_tmp, to: :role)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user