mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 21:43:12 +12:00
38 lines
862 B
Elixir
38 lines
862 B
Elixir
|
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(:users) do
|
||
|
add :is_active, :boolean
|
||
|
end
|
||
|
|
||
|
create table(:accounts, primary_key: false) do
|
||
|
add :id, :uuid, null: false, default: fragment("uuid_generate_v4()"), primary_key: true
|
||
|
add :is_active, :boolean
|
||
|
|
||
|
add :user_id,
|
||
|
references(:users,
|
||
|
column: :id,
|
||
|
name: "accounts_user_id_fkey",
|
||
|
type: :uuid,
|
||
|
prefix: "public"
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def down do
|
||
|
drop constraint(:accounts, "accounts_user_id_fkey")
|
||
|
|
||
|
drop table(:accounts)
|
||
|
|
||
|
alter table(:users) do
|
||
|
remove :is_active
|
||
|
end
|
||
|
end
|
||
|
end
|