mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 21:43:12 +12:00
37 lines
1,022 B
Elixir
37 lines
1,022 B
Elixir
|
defmodule AshPostgres.TestRepo.Migrations.MigrateResources9 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(:managers, primary_key: false) do
|
||
|
add :id, :uuid, null: false, default: fragment("uuid_generate_v4()"), primary_key: true
|
||
|
add :name, :text
|
||
|
add :code, :text, null: false
|
||
|
add :must_be_present, :text, null: false
|
||
|
add :role, :text
|
||
|
|
||
|
add :organization_id,
|
||
|
references(:orgs,
|
||
|
column: :id,
|
||
|
name: "managers_organization_id_fkey",
|
||
|
type: :uuid,
|
||
|
prefix: "public"
|
||
|
)
|
||
|
end
|
||
|
|
||
|
create unique_index(:managers, [:code], name: "managers_uniq_code_index")
|
||
|
end
|
||
|
|
||
|
def down do
|
||
|
drop_if_exists unique_index(:managers, [:code], name: "managers_uniq_code_index")
|
||
|
|
||
|
drop constraint(:managers, "managers_organization_id_fkey")
|
||
|
|
||
|
drop table(:managers)
|
||
|
end
|
||
|
end
|