Update to make Author has many AuthorRoles.
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user