defmodule AshPostgres.TestRepo.Migrations.MigrateResources7 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 modify :score, :bigint add :price, :bigint end create constraint(:posts, :price_must_be_positive, check: "type = 'sponsored' AND price > 0") # This is just to ensure tests are trying out the enum migration logic AshPostgres.Migration.create_enum(AshPostgres.Test.Types.Status) AshPostgres.Migration.drop_enum(AshPostgres.Test.Types.Status) AshPostgres.Migration.create_enum(AshPostgres.Test.Types.Status) alter table(:post_ratings) do modify :score, :bigint end alter table(:integer_posts) do modify :id, :bigint end alter table(:comments) do modify :likes, :bigint end alter table(:comment_ratings) do modify :score, :bigint end end def down do alter table(:comment_ratings) do modify :score, :integer end alter table(:comments) do modify :likes, :integer end alter table(:integer_posts) do modify :id, :integer end alter table(:post_ratings) do modify :score, :integer end drop_if_exists constraint(:posts, :price_must_be_positive) alter table(:posts) do remove :price modify :score, :integer end end end