ash_postgres/priv/test_repo/tenant_migrations/20220518160827_migrate_resources2.exs
Zach Daniel 2a5c7ac4a2 improvement: check_migrations, rename to --check
fix: don't use `table` where we should use `schema` in migration generator
2022-05-18 13:21:58 -04:00

55 lines
No EOL
1.6 KiB
Elixir

defmodule AshPostgres.TestRepo.TenantMigrations.MigrateResources2 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(:multitenant_posts, "multitenant_posts_user_id_fkey")
drop constraint(:multitenant_posts, "multitenant_posts_org_id_fkey")
alter table(:multitenant_posts, prefix: prefix()) do
modify :org_id,
references(:multitenant_orgs,
column: :id,
prefix: "public",
name: "multitenant_posts_org_id_fkey",
type: :uuid
)
end
alter table(:multitenant_posts, prefix: prefix()) do
modify :user_id,
references(:users,
column: :id,
prefix: "public",
name: "multitenant_posts_user_id_fkey",
type: :uuid
)
end
end
def down do
drop constraint(:multitenant_posts, "multitenant_posts_user_id_fkey")
alter table(:multitenant_posts, prefix: prefix()) do
modify :user_id,
references(:users, column: :id, name: "multitenant_posts_user_id_fkey", type: :uuid)
end
drop constraint(:multitenant_posts, "multitenant_posts_org_id_fkey")
alter table(:multitenant_posts, prefix: prefix()) do
modify :org_id,
references(:multitenant_orgs,
column: :id,
name: "multitenant_posts_org_id_fkey",
type: :uuid
)
end
end
end