Codegen keeps recreating foreign key

I think this happened after I added on_delete: delete. It keeps adding this in for every subsequent codegen even though this was previously migrated. Is there possible circular logic?
def up do
drop constraint(:github_installs, "github_installs_app_install_id_fkey")

alter table(:github_installs) do
modify :app_install_id,
references(:installs,
column: :id,
name: "github_installs_app_install_id_fkey",
type: :uuid,
prefix: "public",
on_delete: :delete_all
)
end
end
def up do
drop constraint(:github_installs, "github_installs_app_install_id_fkey")

alter table(:github_installs) do
modify :app_install_id,
references(:installs,
column: :id,
name: "github_installs_app_install_id_fkey",
type: :uuid,
prefix: "public",
on_delete: :delete_all
)
end
end
resource --
references do
reference :app_install, on_delete: :delete
end
references do
reference :app_install, on_delete: :delete
end
Solution:
As it turns out, making multitenancy changes for different resources across multiple commits, instead of all in one go, makes the resource snapshots go a little crazy with attribute changes. I decided to just do all the resource changes in one shot.
Jump to solution
1 Reply
Solution
Songyun
Songyun2mo ago
As it turns out, making multitenancy changes for different resources across multiple commits, instead of all in one go, makes the resource snapshots go a little crazy with attribute changes. I decided to just do all the resource changes in one shot.

Did you find this page helpful?