Current section

Files

Jump to
ash_admin priv repo migrations 20210329174407_migrate_resources9.exs
Raw

priv/repo/migrations/20210329174407_migrate_resources9.exs

defmodule Demo.Repo.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
alter table(:tickets) do
add :organization_id, :uuid
end
create table(:organizations, primary_key: false) do
add :id, :uuid, null: false, default: fragment("uuid_generate_v4()"), primary_key: true
add :name, :text
end
alter table(:tickets) do
modify :organization_id, references(:organizations, type: :uuid, column: :id)
end
end
def down do
alter table(:tickets) do
modify :organization_id, :uuid
end
drop table(:organizations)
alter table(:tickets) do
remove :organization_id
end
end
end