-
-
Notifications
You must be signed in to change notification settings - Fork 137
Expand file tree
/
Copy path20260225131407_migrate_resources70.exs
More file actions
54 lines (43 loc) · 1.37 KB
/
20260225131407_migrate_resources70.exs
File metadata and controls
54 lines (43 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
defmodule AshPostgres.TestRepo.Migrations.MigrateResources70 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(:rollback_children, primary_key: false) do
add(:id, :uuid, null: false, default: fragment("gen_random_uuid()"), primary_key: true)
add(:title, :text, null: false)
add(:rollback_parent_id, :uuid)
end
create table(:rollback_parents, primary_key: false) do
add(:id, :uuid, null: false, default: fragment("gen_random_uuid()"), primary_key: true)
end
alter table(:rollback_children) do
modify(
:rollback_parent_id,
references(:rollback_parents,
column: :id,
name: "rollback_children_rollback_parent_id_fkey",
type: :uuid,
prefix: "public",
on_delete: :delete_all
)
)
end
alter table(:rollback_parents) do
add(:name, :text, null: false)
end
end
def down do
alter table(:rollback_parents) do
remove(:name)
end
drop(constraint(:rollback_children, "rollback_children_rollback_parent_id_fkey"))
alter table(:rollback_children) do
modify(:rollback_parent_id, :uuid)
end
drop(table(:rollback_parents))
drop(table(:rollback_children))
end
end