forked from AkkomaGang/akkoma
change migrations so they can be roll backed
Up to 20210416051708, which is the latest diff between akkoma and pleroma
This commit is contained in:
parent
fd46f83d2d
commit
c6d5a72002
5 changed files with 40 additions and 5 deletions
|
@ -5,9 +5,15 @@
|
||||||
defmodule Pleroma.Repo.Migrations.RemoveMastofeSettingsFromUsers do
|
defmodule Pleroma.Repo.Migrations.RemoveMastofeSettingsFromUsers do
|
||||||
use Ecto.Migration
|
use Ecto.Migration
|
||||||
|
|
||||||
def change do
|
def up do
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
remove_if_exists(:mastofe_settings, :map)
|
remove_if_exists(:mastofe_settings, :map)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
alter table(:users) do
|
||||||
|
add_if_not_exists(:mastofe_settings, :map, default: nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,11 +5,19 @@
|
||||||
defmodule Pleroma.Repo.Migrations.ForcePinnedObjectsToExist do
|
defmodule Pleroma.Repo.Migrations.ForcePinnedObjectsToExist do
|
||||||
use Ecto.Migration
|
use Ecto.Migration
|
||||||
|
|
||||||
def change do
|
def up do
|
||||||
execute("UPDATE users SET pinned_objects = '{}' WHERE pinned_objects IS NULL")
|
execute("UPDATE users SET pinned_objects = '{}' WHERE pinned_objects IS NULL")
|
||||||
|
|
||||||
alter table("users") do
|
alter table("users") do
|
||||||
modify(:pinned_objects, :map, null: false, default: %{})
|
modify(:pinned_objects, :map, null: false, default: %{})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
alter table("users") do
|
||||||
|
modify(:pinned_objects, :map, null: true, default: nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
execute("UPDATE users SET pinned_objects = NULL WHERE pinned_objects = '{}'")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
defmodule Pleroma.Repo.Migrations.AddBirthdayToUsers do
|
defmodule Pleroma.Repo.Migrations.AddBirthdayToUsers do
|
||||||
use Ecto.Migration
|
use Ecto.Migration
|
||||||
|
|
||||||
def change do
|
def up do
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
add_if_not_exists(:birthday, :date)
|
add_if_not_exists(:birthday, :date)
|
||||||
add_if_not_exists(:show_birthday, :boolean, default: false, null: false)
|
add_if_not_exists(:show_birthday, :boolean, default: false, null: false)
|
||||||
|
@ -13,4 +13,13 @@ def change do
|
||||||
|
|
||||||
create_if_not_exists(index(:users, [:show_birthday]))
|
create_if_not_exists(index(:users, [:show_birthday]))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
drop_if_exists(index(:users, [:show_birthday]))
|
||||||
|
|
||||||
|
alter table(:users) do
|
||||||
|
remove_if_exists(:birthday, :date)
|
||||||
|
remove_if_exists(:show_birthday, :boolean)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
defmodule Pleroma.Repo.Migrations.AddLanguageToUsers do
|
defmodule Pleroma.Repo.Migrations.AddLanguageToUsers do
|
||||||
use Ecto.Migration
|
use Ecto.Migration
|
||||||
|
|
||||||
def change do
|
def up do
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
add_if_not_exists(:language, :string)
|
add_if_not_exists(:language, :string)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
alter table(:users) do
|
||||||
|
remove_if_exists(:language, :string)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,9 +5,15 @@
|
||||||
defmodule Pleroma.Repo.Migrations.AddExpiresAtToUserRelationships do
|
defmodule Pleroma.Repo.Migrations.AddExpiresAtToUserRelationships do
|
||||||
use Ecto.Migration
|
use Ecto.Migration
|
||||||
|
|
||||||
def change do
|
def up do
|
||||||
alter table(:user_relationships) do
|
alter table(:user_relationships) do
|
||||||
add_if_not_exists(:expires_at, :utc_datetime)
|
add_if_not_exists(:expires_at, :utc_datetime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
alter table(:user_relationships) do
|
||||||
|
remove_if_exists(:expires_at, :utc_datetime)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue