refactor: update migration for UUIDv7 and explicit FK constraint
- Add on_delete: :restrict to users.role_id foreign key - Update roles.id to use uuid_generate_v7() default - Regenerate resource snapshots
This commit is contained in:
parent
82ec4e565a
commit
402a78dd0a
3 changed files with 140 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
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