defmodule AshPostgres.TestRepo.Migrations.MigrateResources29 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 create table(:stateful_post_followers, primary_key: false) do add(:id, :uuid, null: false, default: fragment("gen_random_uuid()"), primary_key: true) add(:order, :bigint) add(:state, :text, default: "active") add( :post_id, references(:posts, column: :id, name: "stateful_post_followers_post_id_fkey", type: :uuid, prefix: "public" ), null: false ) add( :follower_id, references(:users, column: :id, name: "stateful_post_followers_follower_id_fkey", type: :uuid, prefix: "public" ), null: false ) end create( unique_index(:stateful_post_followers, ["post_id", "follower_id", "state"], name: "stateful_post_followers_join_attributes_index" ) ) end def down do drop_if_exists( unique_index(:stateful_post_followers, ["post_id", "follower_id", "state"], name: "stateful_post_followers_join_attributes_index" ) ) drop(constraint(:stateful_post_followers, "stateful_post_followers_post_id_fkey")) drop(constraint(:stateful_post_followers, "stateful_post_followers_follower_id_fkey")) drop(table(:stateful_post_followers)) end end