mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-21 05:53:18 +12:00
41 lines
1 KiB
Elixir
41 lines
1 KiB
Elixir
|
defmodule AshPostgres.TestRepo.Migrations.MigrateResources17 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(:post_followers, primary_key: false) do
|
||
|
add :id, :uuid, null: false, default: fragment("uuid_generate_v4()"), primary_key: true
|
||
|
|
||
|
add :post_id,
|
||
|
references(:posts,
|
||
|
column: :id,
|
||
|
name: "post_followers_post_id_fkey",
|
||
|
type: :uuid,
|
||
|
prefix: "public"
|
||
|
),
|
||
|
null: false
|
||
|
|
||
|
add :user_id,
|
||
|
references(:users,
|
||
|
column: :id,
|
||
|
name: "post_followers_user_id_fkey",
|
||
|
type: :uuid,
|
||
|
prefix: "public"
|
||
|
),
|
||
|
null: false
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def down do
|
||
|
drop constraint(:post_followers, "post_followers_post_id_fkey")
|
||
|
|
||
|
drop constraint(:post_followers, "post_followers_user_id_fkey")
|
||
|
|
||
|
drop table(:post_followers)
|
||
|
end
|
||
|
end
|