2021-11-14 07:55:49 +13:00
|
|
|
defmodule AshPostgres.TestRepo.TenantMigrations.MigrateResources1 do
|
2021-07-25 03:28:58 +12:00
|
|
|
@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
|
2021-11-14 07:55:49 +13:00
|
|
|
create table(:multitenant_posts, primary_key: false, prefix: prefix()) do
|
|
|
|
add :id, :uuid, null: false, default: fragment("uuid_generate_v4()"), primary_key: true
|
|
|
|
add :name, :text
|
|
|
|
|
|
|
|
add :org_id,
|
|
|
|
references(:multitenant_orgs,
|
|
|
|
column: :id,
|
|
|
|
prefix: "public",
|
|
|
|
name: "multitenant_posts_org_id_fkey",
|
|
|
|
type: :uuid
|
|
|
|
)
|
|
|
|
|
2021-07-25 03:28:58 +12:00
|
|
|
add :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")
|
|
|
|
|
2021-11-14 07:55:49 +13:00
|
|
|
drop constraint(:multitenant_posts, "multitenant_posts_org_id_fkey")
|
|
|
|
|
|
|
|
drop table(:multitenant_posts, prefix: prefix())
|
2021-07-25 03:28:58 +12:00
|
|
|
end
|
|
|
|
end
|