akkoma/priv/repo/migrations/20220911195347_add_user_frontend_profiles.exs

29 lines
962 B
Elixir
Raw Normal View History

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]))
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]))
drop_if_exists(
unique_index(:user_frontend_setting_profiles, [:user_id, :frontend_name, :profile_name])
)
end
end