From 7d41e69a112170baf9b285314c42c69ebf4730ab Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Tue, 2 Jul 2024 12:46:03 -0400 Subject: [PATCH] chore: gen migrations --- .../multitenant_orgs/20240702164513.json | 83 +++++++++++++++++++ .../20240702164513_migrate_resources32.exs | 23 +++++ 2 files changed, 106 insertions(+) create mode 100644 priv/resource_snapshots/test_repo/multitenant_orgs/20240702164513.json create mode 100644 priv/test_repo/migrations/20240702164513_migrate_resources32.exs diff --git a/priv/resource_snapshots/test_repo/multitenant_orgs/20240702164513.json b/priv/resource_snapshots/test_repo/multitenant_orgs/20240702164513.json new file mode 100644 index 0000000..a7d1b16 --- /dev/null +++ b/priv/resource_snapshots/test_repo/multitenant_orgs/20240702164513.json @@ -0,0 +1,83 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "fragment(\"gen_random_uuid()\")", + "generated?": false, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "uuid" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "name", + "type": "text" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "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": "org_id", + "global": true, + "strategy": "attribute" + }, + "name": "multitenant_orgs_owner_id_fkey", + "on_delete": null, + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "users" + }, + "size": null, + "source": "owner_id", + "type": "text" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [], + "custom_statements": [], + "has_create_action": true, + "hash": "8A0A6960023A27597EB918B7EDCA957E5AA9C78D3BE83FE7924A1F5BFA531F6C", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "multitenant_orgs_unique_by_name_index", + "keys": [ + { + "type": "atom", + "value": "name" + } + ], + "name": "unique_by_name", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "id", + "global": true, + "strategy": "attribute" + }, + "repo": "Elixir.AshPostgres.TestRepo", + "schema": null, + "table": "multitenant_orgs" +} \ No newline at end of file diff --git a/priv/test_repo/migrations/20240702164513_migrate_resources32.exs b/priv/test_repo/migrations/20240702164513_migrate_resources32.exs new file mode 100644 index 0000000..fed5ff7 --- /dev/null +++ b/priv/test_repo/migrations/20240702164513_migrate_resources32.exs @@ -0,0 +1,23 @@ +defmodule AshPostgres.TestRepo.Migrations.MigrateResources32 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(:multitenant_orgs) do + remove(:owner_id) + add(:owner_id, :text) + end + end + + def down do + alter table(:multitenant_orgs) do + remove(:owner_id) + add(:owner_id, :uuid) + end + end +end