defmodule AshPostgres.TestRepo.Migrations.MigrateResources8 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(:posts) do add :status, :status end drop constraint(:post_ratings, "post_ratings_id_fkey") drop constraint(:comments, "special_name_fkey") drop constraint(:comment_ratings, "comment_ratings_id_fkey") alter table(:comment_ratings) do modify :resource_id, references(:comments, column: :id, name: "comment_ratings_id_fkey", type: :uuid) end alter table(:comments) do modify :post_id, references(:posts, column: :id, name: "special_name_fkey", type: :uuid, on_delete: :delete_all, on_update: :update_all ) end alter table(:post_ratings) do modify :resource_id, references(:posts, column: :id, name: "post_ratings_id_fkey", type: :uuid) end end def down do drop constraint(:post_ratings, "post_ratings_id_fkey") alter table(:post_ratings) do modify :resource_id, references(:posts, column: :id, name: "post_ratings_id_fkey", type: :uuid) end drop constraint(:comments, "special_name_fkey") alter table(:comments) do modify :post_id, references(:posts, column: :id, name: "special_name_fkey", type: :uuid, on_delete: :delete_all, on_update: :update_all ) end drop constraint(:comment_ratings, "comment_ratings_id_fkey") alter table(:comment_ratings) do modify :resource_id, references(:comments, column: :id, name: "comment_ratings_id_fkey", type: :uuid) end alter table(:posts) do remove :status end end end