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:
parent
c6a766377a
commit
ce1d5790a3
2 changed files with 1 additions and 22 deletions
|
|
@ -13,7 +13,7 @@ defmodule Mv.Repo.Migrations.AddAuthorizationDomain do
|
||||||
end
|
end
|
||||||
|
|
||||||
create table(:roles, primary_key: false) do
|
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
|
end
|
||||||
|
|
||||||
alter table(:users) do
|
alter table(:users) do
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue