2022-09-11 21:38:59 +00:00
|
|
|
defmodule Pleroma.Repo.Migrations.AddUserFrontendProfiles do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def up do
|
|
|
|
create_if_not_exists table("user_frontend_setting_profiles", primary_key: false) do
|
|
|
|
add(:user_id, references(:users, type: :uuid, on_delete: :delete_all), primary_key: true)
|
|
|
|
add(:frontend_name, :string, primary_key: true)
|
|
|
|
add(:profile_name, :string, primary_key: true)
|
|
|
|
add(:settings, :map)
|
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
2022-09-12 15:04:19 +00:00
|
|
|
create_if_not_exists(index(:user_frontend_setting_profiles, [:user_id, :frontend_name]))
|
2022-09-11 21:38:59 +00:00
|
|
|
|
|
|
|
create_if_not_exists(
|
|
|
|
unique_index(:user_frontend_setting_profiles, [:user_id, :frontend_name, :profile_name])
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
|
|
|
drop_if_exists(table("user_frontend_setting_profiles"))
|
2022-09-12 15:04:19 +00:00
|
|
|
drop_if_exists(index(:user_frontend_setting_profiles, [:user_id, :frontend_name]))
|
2022-09-11 21:38:59 +00:00
|
|
|
|
|
|
|
drop_if_exists(
|
|
|
|
unique_index(:user_frontend_setting_profiles, [:user_id, :frontend_name, :profile_name])
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|