Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"attributes": [
{
"allow_nil?": false,
"default": "fragment(\"gen_random_uuid()\")",
"generated?": false,
"precision": null,
"primary_key?": true,
"references": null,
"scale": null,
"size": null,
"source": "id",
"type": "uuid"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": null,
"scale": null,
"size": null,
"source": "title",
"type": "text"
},
{
"allow_nil?": true,
"default": "nil",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": {
"deferrable": false,
"destination_attribute": "id",
"destination_attribute_default": null,
"destination_attribute_generated": null,
"index?": false,
"match_type": null,
"match_with": null,
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"name": "rollback_children_rollback_parent_id_fkey",
"on_delete": "delete",
"on_update": null,
"primary_key?": true,
"schema": "public",
"table": "rollback_parents"
},
"scale": null,
"size": null,
"source": "rollback_parent_id",
"type": "uuid"
}
],
"base_filter": null,
"check_constraints": [],
"create_table_options": null,
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true,
"hash": "84B94C6E7E9C2B15D35A96914F1F125C3B8188FDD1F8C4835F9B95E3B2C205A9",
"identities": [],
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"repo": "Elixir.AshPostgres.TestRepo",
"schema": null,
"table": "rollback_children"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"attributes": [
{
"allow_nil?": false,
"default": "fragment(\"gen_random_uuid()\")",
"generated?": false,
"precision": null,
"primary_key?": true,
"references": null,
"scale": null,
"size": null,
"source": "id",
"type": "uuid"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": null,
"scale": null,
"size": null,
"source": "name",
"type": "text"
}
],
"base_filter": null,
"check_constraints": [],
"create_table_options": null,
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true,
"hash": "D48EF295250D00CBF79C15D7D2F283C68ED48B0E20E618B0490E81D735BBB2A0",
"identities": [],
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"repo": "Elixir.AshPostgres.TestRepo",
"schema": null,
"table": "rollback_parents"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"attributes": [
{
"allow_nil?": false,
"default": "fragment(\"gen_random_uuid()\")",
"generated?": false,
"precision": null,
"primary_key?": true,
"references": null,
"scale": null,
"size": null,
"source": "id",
"type": "uuid"
},
{
"allow_nil?": false,
"default": "nil",
"generated?": false,
"precision": null,
"primary_key?": false,
"references": null,
"scale": null,
"size": null,
"source": "name",
"type": "text"
}
],
"base_filter": null,
"check_constraints": [],
"create_table_options": null,
"custom_indexes": [],
"custom_statements": [],
"has_create_action": true,
"hash": "4A01DCA3229485184855683251C5175BBB828A8299B247C9F6F19972863040F8",
"identities": [
{
"all_tenants?": false,
"base_filter": null,
"index_name": "rollback_parents_unique_name_index",
"keys": [
{
"type": "atom",
"value": "name"
}
],
"name": "unique_name",
"nils_distinct?": true,
"where": null
}
],
"multitenancy": {
"attribute": null,
"global": null,
"strategy": null
},
"repo": "Elixir.AshPostgres.TestRepo",
"schema": null,
"table": "rollback_parents"
}
54 changes: 54 additions & 0 deletions priv/test_repo/migrations/20260225131407_migrate_resources70.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
19 changes: 19 additions & 0 deletions priv/test_repo/migrations/20260226084405_migrate_resources71.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
defmodule AshPostgres.TestRepo.Migrations.MigrateResources71 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(unique_index(:rollback_parents, [:name], name: "rollback_parents_unique_name_index"))
end

def down do
drop_if_exists(
unique_index(:rollback_parents, [:name], name: "rollback_parents_unique_name_index")
)
end
end
Loading
Loading