From cf8dd95064fb0b4aad50e16d0d0235a99f794c9e Mon Sep 17 00:00:00 2001 From: Inhji Date: Sun, 9 Apr 2023 16:12:03 +0200 Subject: [PATCH] fix note image references --- .../20230409135158_fix_note_image_reference.exs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 priv/repo/migrations/20230409135158_fix_note_image_reference.exs diff --git a/priv/repo/migrations/20230409135158_fix_note_image_reference.exs b/priv/repo/migrations/20230409135158_fix_note_image_reference.exs new file mode 100644 index 0000000..6f67cb6 --- /dev/null +++ b/priv/repo/migrations/20230409135158_fix_note_image_reference.exs @@ -0,0 +1,17 @@ +defmodule Chiya.Repo.Migrations.FixNoteImageReference do + use Ecto.Migration + + def up do + drop constraint :note_images, "note_images_note_id_fkey" + alter table(:note_images) do + modify :note_id, references(:notes, on_delete: :delete_all) + end + end + + def down do + drop constraint :note_images, "note_images_note_id_fkey" + alter table(:note_images) do + modify :note_id, references(:notes, on_delete: :nothing) + end + end +end