Files
Mixer/priv/repo/migrations/20260331210904_cascade_delete_tweet_relations.exs

64 lines
1.5 KiB
Elixir

defmodule Mixer.Repo.Migrations.CascadeDeleteTweetRelations 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
drop constraint(:tweet_likes, "tweet_likes_tweet_id_fkey")
alter table(:tweet_likes) do
modify :tweet_id,
references(:tweets,
column: :id,
name: "tweet_likes_tweet_id_fkey",
type: :uuid,
prefix: "public",
on_delete: :delete_all
)
end
drop constraint(:media, "media_tweet_id_fkey")
alter table(:media) do
modify :tweet_id,
references(:tweets,
column: :id,
name: "media_tweet_id_fkey",
type: :uuid,
prefix: "public",
on_delete: :delete_all
)
end
end
def down do
drop constraint(:media, "media_tweet_id_fkey")
alter table(:media) do
modify :tweet_id,
references(:tweets,
column: :id,
name: "media_tweet_id_fkey",
type: :uuid,
prefix: "public"
)
end
drop constraint(:tweet_likes, "tweet_likes_tweet_id_fkey")
alter table(:tweet_likes) do
modify :tweet_id,
references(:tweets,
column: :id,
name: "tweet_likes_tweet_id_fkey",
type: :uuid,
prefix: "public"
)
end
end
end