chiya/priv/repo/migrations/20230409135158_fix_note_image_reference.exs

20 lines
459 B
Elixir
Raw Permalink Normal View History

2023-04-09 16:12:03 +02:00
defmodule Chiya.Repo.Migrations.FixNoteImageReference do
use Ecto.Migration
def up do
2023-04-10 12:08:19 +02:00
drop constraint(:note_images, "note_images_note_id_fkey")
2023-04-09 16:12:03 +02:00
alter table(:note_images) do
modify :note_id, references(:notes, on_delete: :delete_all)
end
end
def down do
2023-04-10 12:08:19 +02:00
drop constraint(:note_images, "note_images_note_id_fkey")
2023-04-09 16:12:03 +02:00
alter table(:note_images) do
modify :note_id, references(:notes, on_delete: :nothing)
end
end
end