Update to make Author has many AuthorRoles.

This commit is contained in:
2025-03-13 17:28:09 +02:00
parent ecdd4089e5
commit 9ad3ca2ee1
5 changed files with 271 additions and 5 deletions
@@ -0,0 +1,43 @@
defmodule DecentralisedBookIndex.Repo.Migrations.UpdateAuthorAndAuthorRoleRelationship 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(:authors) do
remove :author_role_id
end
alter table(:author_role) do
add :author_id,
references(:authors,
column: :id,
name: "author_role_author_id_fkey",
type: :uuid,
prefix: "public"
)
end
end
def down do
drop constraint(:author_role, "author_role_author_id_fkey")
alter table(:author_role) do
remove :author_id
end
alter table(:authors) do
add :author_role_id,
references(:author_role,
column: :id,
name: "authors_author_role_id_fkey",
type: :uuid,
prefix: "public"
)
end
end
end