refactor: squash migrations into single authorization domain migration

Combine initial authorization migration with UUIDv7 update into
one migration. Migration now creates roles table with UUIDv7
default and explicit on_delete: :restrict FK constraint.
This commit is contained in:
Moritz 2026-01-06 18:37:39 +01:00
parent c6a766377a
commit ce1d5790a3
2 changed files with 1 additions and 22 deletions

View file

@ -13,7 +13,7 @@ defmodule Mv.Repo.Migrations.AddAuthorizationDomain do
end
create table(:roles, primary_key: false) do
add :id, :uuid, null: false, default: fragment("gen_random_uuid()"), primary_key: true
add :id, :uuid, null: false, default: fragment("uuid_generate_v7()"), primary_key: true
end
alter table(:users) do

View file

@ -1,21 +0,0 @@
defmodule Mv.Repo.Migrations.UpdateRoleToUuidv7 do
@moduledoc """
Updates resources based on their most recent snapshots.
This file was autogenerated with `mix ash_postgres.generate_migrations`
"""
use Ecto.Migration
def up do
alter table(:roles) do
modify :id, :uuid, default: fragment("uuid_generate_v7()")
end
end
def down do
alter table(:roles) do
modify :id, :uuid, default: fragment("gen_random_uuid()")
end
end
end