From eae85a0a202f241ca121e0d467d684b9ef73bd92 Mon Sep 17 00:00:00 2001 From: Riccardo Binetti Date: Fri, 4 Oct 2024 18:24:43 +0200 Subject: [PATCH] Swap :id and :tenant_id columns in match_full unique indexes Make everything consistent, :tenant_id is always the first column in indexes. Migrations generated with: mix ash_postgres.generate_migrations swap_id_and_tenant_id_used_for_match_full Signed-off-by: Riccardo Binetti --- backend/lib/edgehog/multitenant_resource.ex | 6 +- ...p_id_and_tenant_id_used_for_match_full.exs | 125 ++++++++ .../20241004162342.json | 217 ++++++++++++++ .../repo/base_images/20241004162342.json | 223 ++++++++++++++ .../repo/device_groups/20241004162342.json | 213 ++++++++++++++ .../repo/devices/20241004162342.json | 243 ++++++++++++++++ .../20241004162342.json | 179 ++++++++++++ .../repo/hardware_types/20241004162342.json | 172 +++++++++++ .../repo/ota_operations/20241004162342.json | 214 ++++++++++++++ .../repo/realms/20241004162342.json | 227 +++++++++++++++ .../20241004162342.json | 179 ++++++++++++ .../repo/system_models/20241004162342.json | 223 ++++++++++++++ .../repo/tags/20241004162342.json | 148 ++++++++++ .../20241004162342.json | 275 ++++++++++++++++++ .../repo/update_campaigns/20241004162342.json | 245 ++++++++++++++++ .../repo/update_channels/20241004162342.json | 172 +++++++++++ 16 files changed, 3057 insertions(+), 4 deletions(-) create mode 100644 backend/priv/repo/migrations/20241004162342_swap_id_and_tenant_id_used_for_match_full.exs create mode 100644 backend/priv/resource_snapshots/repo/base_image_collections/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/base_images/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/device_groups/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/devices/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/hardware_type_part_numbers/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/hardware_types/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/ota_operations/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/realms/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/system_model_part_numbers/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/system_models/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/tags/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/update_campaign_targets/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/update_campaigns/20241004162342.json create mode 100644 backend/priv/resource_snapshots/repo/update_channels/20241004162342.json diff --git a/backend/lib/edgehog/multitenant_resource.ex b/backend/lib/edgehog/multitenant_resource.ex index d049d80fb..e286e01ed 100644 --- a/backend/lib/edgehog/multitenant_resource.ex +++ b/backend/lib/edgehog/multitenant_resource.ex @@ -53,7 +53,7 @@ defmodule Edgehog.MultitenantResource do reference :tenant, on_delete: :delete end - # We have to create a unique index on `[:id, :tenant_id]` to be able to use composite + # We have to create a unique index on `[:tenant_id, :id]` to be able to use composite # foreign keys (i.e. `with: [tenant_id: :tenant_id]`). # We have to wrap this in an `if` because some resources (e.g. many-to-many join tables # like `devices_tags`) don't have a single :id primary key. Those resources manually add @@ -63,9 +63,7 @@ defmodule Edgehog.MultitenantResource do custom_indexes do # Assumptions: # - There is a primary key and it's called :id - # We use `all_tenants?: true` so we can control the order of the index and be - # consistent with the indexes that were created when using Ecto manually - index [:id, :tenant_id], unique: true, all_tenants?: true + index [:id], unique: true end end diff --git a/backend/priv/repo/migrations/20241004162342_swap_id_and_tenant_id_used_for_match_full.exs b/backend/priv/repo/migrations/20241004162342_swap_id_and_tenant_id_used_for_match_full.exs new file mode 100644 index 000000000..104950145 --- /dev/null +++ b/backend/priv/repo/migrations/20241004162342_swap_id_and_tenant_id_used_for_match_full.exs @@ -0,0 +1,125 @@ +defmodule Edgehog.Repo.Migrations.SwapIdAndTenantIdUsedForMatchFull 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 + drop_if_exists index(:update_channels, [:id, :tenant_id]) + + create index(:update_channels, [:tenant_id, :id], unique: true) + + drop_if_exists index(:update_campaigns, [:id, :tenant_id]) + + create index(:update_campaigns, [:tenant_id, :id], unique: true) + + drop_if_exists index(:update_campaign_targets, [:id, :tenant_id]) + + create index(:update_campaign_targets, [:tenant_id, :id], unique: true) + + drop_if_exists index(:tags, [:id, :tenant_id]) + + create index(:tags, [:tenant_id, :id], unique: true) + + drop_if_exists index(:system_models, [:id, :tenant_id]) + + create index(:system_models, [:tenant_id, :id], unique: true) + + drop_if_exists index(:system_model_part_numbers, [:id, :tenant_id]) + + create index(:system_model_part_numbers, [:tenant_id, :id], unique: true) + + drop_if_exists index(:realms, [:id, :tenant_id]) + + create index(:realms, [:tenant_id, :id], unique: true) + + drop_if_exists index(:ota_operations, [:id, :tenant_id]) + + create index(:ota_operations, [:tenant_id, :id], unique: true) + + drop_if_exists index(:hardware_types, [:id, :tenant_id]) + + create index(:hardware_types, [:tenant_id, :id], unique: true) + + drop_if_exists index(:hardware_type_part_numbers, [:id, :tenant_id]) + + create index(:hardware_type_part_numbers, [:tenant_id, :id], unique: true) + + drop_if_exists index(:devices, [:id, :tenant_id]) + + create index(:devices, [:tenant_id, :id], unique: true) + + drop_if_exists index(:device_groups, [:id, :tenant_id]) + + create index(:device_groups, [:tenant_id, :id], unique: true) + + drop_if_exists index(:base_images, [:id, :tenant_id]) + + create index(:base_images, [:tenant_id, :id], unique: true) + + drop_if_exists index(:base_image_collections, [:id, :tenant_id]) + + create index(:base_image_collections, [:tenant_id, :id], unique: true) + end + + def down do + drop_if_exists index(:base_image_collections, [:tenant_id, :id]) + + create index(:base_image_collections, [:id, :tenant_id], unique: true) + + drop_if_exists index(:base_images, [:tenant_id, :id]) + + create index(:base_images, [:id, :tenant_id], unique: true) + + drop_if_exists index(:device_groups, [:tenant_id, :id]) + + create index(:device_groups, [:id, :tenant_id], unique: true) + + drop_if_exists index(:devices, [:tenant_id, :id]) + + create index(:devices, [:id, :tenant_id], unique: true) + + drop_if_exists index(:hardware_type_part_numbers, [:tenant_id, :id]) + + create index(:hardware_type_part_numbers, [:id, :tenant_id], unique: true) + + drop_if_exists index(:hardware_types, [:tenant_id, :id]) + + create index(:hardware_types, [:id, :tenant_id], unique: true) + + drop_if_exists index(:ota_operations, [:tenant_id, :id]) + + create index(:ota_operations, [:id, :tenant_id], unique: true) + + drop_if_exists index(:realms, [:tenant_id, :id]) + + create index(:realms, [:id, :tenant_id], unique: true) + + drop_if_exists index(:system_model_part_numbers, [:tenant_id, :id]) + + create index(:system_model_part_numbers, [:id, :tenant_id], unique: true) + + drop_if_exists index(:system_models, [:tenant_id, :id]) + + create index(:system_models, [:id, :tenant_id], unique: true) + + drop_if_exists index(:tags, [:tenant_id, :id]) + + create index(:tags, [:id, :tenant_id], unique: true) + + drop_if_exists index(:update_campaign_targets, [:tenant_id, :id]) + + create index(:update_campaign_targets, [:id, :tenant_id], unique: true) + + drop_if_exists index(:update_campaigns, [:tenant_id, :id]) + + create index(:update_campaigns, [:id, :tenant_id], unique: true) + + drop_if_exists index(:update_channels, [:tenant_id, :id]) + + create index(:update_channels, [:id, :tenant_id], unique: true) + end +end diff --git a/backend/priv/resource_snapshots/repo/base_image_collections/20241004162342.json b/backend/priv/resource_snapshots/repo/base_image_collections/20241004162342.json new file mode 100644 index 000000000..64a1ce46b --- /dev/null +++ b/backend/priv/resource_snapshots/repo/base_image_collections/20241004162342.json @@ -0,0 +1,217 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "name", + "type": "text" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "handle", + "type": "text" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "base_image_collections_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "allow_nil?": false, + "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": "full", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "base_image_collections_system_model_id_fkey", + "on_delete": "nothing", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "system_models" + }, + "size": null, + "source": "system_model_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "09AEADC1ACB92FF4DF87315A7F456DF5459A3746CE7AFA686480DB8ACD8E65AF", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "base_image_collections_handle_index", + "keys": [ + { + "type": "atom", + "value": "handle" + } + ], + "name": "handle", + "nils_distinct?": true, + "where": null + }, + { + "all_tenants?": false, + "base_filter": null, + "index_name": "base_image_collections_name_index", + "keys": [ + { + "type": "atom", + "value": "name" + } + ], + "name": "name", + "nils_distinct?": true, + "where": null + }, + { + "all_tenants?": false, + "base_filter": null, + "index_name": "base_image_collections_system_model_id_index", + "keys": [ + { + "type": "atom", + "value": "system_model_id" + } + ], + "name": "system_model_id", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "base_image_collections" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/base_images/20241004162342.json b/backend/priv/resource_snapshots/repo/base_images/20241004162342.json new file mode 100644 index 000000000..4c78f503c --- /dev/null +++ b/backend/priv/resource_snapshots/repo/base_images/20241004162342.json @@ -0,0 +1,223 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "version", + "type": "text" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "starting_version_requirement", + "type": "text" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "url", + "type": "text" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "description", + "type": "map" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "release_display_name", + "type": "map" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "base_images_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "id", + "destination_attribute_default": null, + "destination_attribute_generated": null, + "index?": true, + "match_type": "full", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "base_images_base_image_collection_id_fkey", + "on_delete": "nothing", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "base_image_collections" + }, + "size": null, + "source": "base_image_collection_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "D92A603205912DB42F648964E6DB538264B136C90B8CAE70A7A54EE4EC0A1ABF", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "base_images_unique_base_image_collection_version_index", + "keys": [ + { + "type": "atom", + "value": "version" + }, + { + "type": "atom", + "value": "base_image_collection_id" + } + ], + "name": "unique_base_image_collection_version", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "base_images" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/device_groups/20241004162342.json b/backend/priv/resource_snapshots/repo/device_groups/20241004162342.json new file mode 100644 index 000000000..85a1fc4cb --- /dev/null +++ b/backend/priv/resource_snapshots/repo/device_groups/20241004162342.json @@ -0,0 +1,213 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "name", + "type": "text" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "handle", + "type": "text" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "selector", + "type": "text" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "device_groups_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "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": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "device_groups_update_channel_id_fkey", + "on_delete": "nilify", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "update_channels" + }, + "size": null, + "source": "update_channel_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "234A9D1AEA2A3622ADF881B594FACC6AD4C3C675EB93BF3FF4660147250424D6", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "device_groups_handle_index", + "keys": [ + { + "type": "atom", + "value": "handle" + } + ], + "name": "handle", + "nils_distinct?": true, + "where": null + }, + { + "all_tenants?": false, + "base_filter": null, + "index_name": "device_groups_name_index", + "keys": [ + { + "type": "atom", + "value": "name" + } + ], + "name": "name", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "device_groups" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/devices/20241004162342.json b/backend/priv/resource_snapshots/repo/devices/20241004162342.json new file mode 100644 index 000000000..9bb8a413c --- /dev/null +++ b/backend/priv/resource_snapshots/repo/devices/20241004162342.json @@ -0,0 +1,243 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "device_id", + "type": "text" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "name", + "type": "text" + }, + { + "allow_nil?": false, + "default": "false", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "online", + "type": "boolean" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "last_connection", + "type": "utc_datetime" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "last_disconnection", + "type": "utc_datetime" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "serial_number", + "type": "text" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "devices_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "id", + "destination_attribute_default": null, + "destination_attribute_generated": null, + "index?": true, + "match_type": "full", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "devices_realm_id_fkey", + "on_delete": "nothing", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "realms" + }, + "size": null, + "source": "realm_id", + "type": "bigint" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "part_number", + "type": "text" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "2ADDBA29988AC70FC42BB11665812AC84CDACB25C908870A0A11102A70661DA6", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "devices_unique_realm_device_id_index", + "keys": [ + { + "type": "atom", + "value": "device_id" + }, + { + "type": "atom", + "value": "realm_id" + } + ], + "name": "unique_realm_device_id", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "devices" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/hardware_type_part_numbers/20241004162342.json b/backend/priv/resource_snapshots/repo/hardware_type_part_numbers/20241004162342.json new file mode 100644 index 000000000..3674a6c05 --- /dev/null +++ b/backend/priv/resource_snapshots/repo/hardware_type_part_numbers/20241004162342.json @@ -0,0 +1,179 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "part_number", + "type": "text" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "hardware_type_part_numbers_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "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?": true, + "match_type": "simple", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "hardware_type_part_numbers_hardware_type_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "hardware_types" + }, + "size": null, + "source": "hardware_type_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "624096A3B3E3D8BD905A13DF40E27AC30A123559472CBD281040FE6C2400A4D7", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "hardware_type_part_numbers_part_number_index", + "keys": [ + { + "type": "atom", + "value": "part_number" + } + ], + "name": "part_number", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "hardware_type_part_numbers" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/hardware_types/20241004162342.json b/backend/priv/resource_snapshots/repo/hardware_types/20241004162342.json new file mode 100644 index 000000000..9a321d456 --- /dev/null +++ b/backend/priv/resource_snapshots/repo/hardware_types/20241004162342.json @@ -0,0 +1,172 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "handle", + "type": "text" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "name", + "type": "text" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "hardware_types_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "E0B4186A6869BEA8B3C92C36B1CFE2AA2C898B46F0C8CF9DE2B85E6B0D7A3905", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "hardware_types_handle_index", + "keys": [ + { + "type": "atom", + "value": "handle" + } + ], + "name": "handle", + "nils_distinct?": true, + "where": null + }, + { + "all_tenants?": false, + "base_filter": null, + "index_name": "hardware_types_name_index", + "keys": [ + { + "type": "atom", + "value": "name" + } + ], + "name": "name", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "hardware_types" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/ota_operations/20241004162342.json b/backend/priv/resource_snapshots/repo/ota_operations/20241004162342.json new file mode 100644 index 000000000..5a263c343 --- /dev/null +++ b/backend/priv/resource_snapshots/repo/ota_operations/20241004162342.json @@ -0,0 +1,214 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "fragment(\"gen_random_uuid()\")", + "generated?": false, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "uuid" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "base_image_url", + "type": "text" + }, + { + "allow_nil?": false, + "default": "\"pending\"", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "status", + "type": "text" + }, + { + "allow_nil?": false, + "default": "0", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "status_progress", + "type": "bigint" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "status_code", + "type": "text" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "message", + "type": "text" + }, + { + "allow_nil?": true, + "default": "false", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "is_manual", + "type": "boolean" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "ota_operations_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "id", + "destination_attribute_default": null, + "destination_attribute_generated": null, + "index?": true, + "match_type": "full", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "ota_operations_device_id_fkey", + "on_delete": "nothing", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "devices" + }, + "size": null, + "source": "device_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "2839F1887D828DADE8C827D6CD0B4143C448CF2B678BC24DB68792E84DB92325", + "identities": [], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "ota_operations" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/realms/20241004162342.json b/backend/priv/resource_snapshots/repo/realms/20241004162342.json new file mode 100644 index 000000000..3d7e9847e --- /dev/null +++ b/backend/priv/resource_snapshots/repo/realms/20241004162342.json @@ -0,0 +1,227 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "name", + "type": "text" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "private_key", + "type": "text" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "realms_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "allow_nil?": false, + "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": null, + "global": null, + "strategy": null + }, + "name": "realms_cluster_id_fkey", + "on_delete": null, + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "clusters" + }, + "size": null, + "source": "cluster_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "cluster_id" + ], + "fields": [ + { + "type": "atom", + "value": "cluster_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "77E0739243FDBB730AF719F4BBC6037556E7CDFB523D461F412E90A76C54C477", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "realms_name_index", + "keys": [ + { + "type": "atom", + "value": "name" + } + ], + "name": "name", + "nils_distinct?": true, + "where": null + }, + { + "all_tenants?": true, + "base_filter": null, + "index_name": "realms_unique_name_for_cluster_index", + "keys": [ + { + "type": "atom", + "value": "name" + }, + { + "type": "atom", + "value": "cluster_id" + } + ], + "name": "unique_name_for_cluster", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "realms" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/system_model_part_numbers/20241004162342.json b/backend/priv/resource_snapshots/repo/system_model_part_numbers/20241004162342.json new file mode 100644 index 000000000..fe2064769 --- /dev/null +++ b/backend/priv/resource_snapshots/repo/system_model_part_numbers/20241004162342.json @@ -0,0 +1,179 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "part_number", + "type": "text" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "system_model_part_numbers_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "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?": true, + "match_type": "simple", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "system_model_part_numbers_system_model_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "system_models" + }, + "size": null, + "source": "system_model_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "E814CB15DCF3F639C2E37C7E8F08E38382BC20F820CE5B9D913118D944AE5A41", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "system_model_part_numbers_part_number_index", + "keys": [ + { + "type": "atom", + "value": "part_number" + } + ], + "name": "part_number", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "system_model_part_numbers" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/system_models/20241004162342.json b/backend/priv/resource_snapshots/repo/system_models/20241004162342.json new file mode 100644 index 000000000..6f4248aa6 --- /dev/null +++ b/backend/priv/resource_snapshots/repo/system_models/20241004162342.json @@ -0,0 +1,223 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "handle", + "type": "text" + }, + { + "allow_nil?": false, + "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": null, + "size": null, + "source": "picture_url", + "type": "text" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "description", + "type": "map" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "system_models_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "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?": true, + "match_type": "full", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "system_models_hardware_type_id_fkey", + "on_delete": "nothing", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "hardware_types" + }, + "size": null, + "source": "hardware_type_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "1D0900CA36D5AFA02C2D1A1CA19364479AF14DCD45B7E216A11682D5A4DEB176", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "system_models_handle_index", + "keys": [ + { + "type": "atom", + "value": "handle" + } + ], + "name": "handle", + "nils_distinct?": true, + "where": null + }, + { + "all_tenants?": false, + "base_filter": null, + "index_name": "system_models_name_index", + "keys": [ + { + "type": "atom", + "value": "name" + } + ], + "name": "name", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "system_models" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/tags/20241004162342.json b/backend/priv/resource_snapshots/repo/tags/20241004162342.json new file mode 100644 index 000000000..a86d80baf --- /dev/null +++ b/backend/priv/resource_snapshots/repo/tags/20241004162342.json @@ -0,0 +1,148 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "name", + "type": "text" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "tags_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "B3491D881F9A762368B4330768CDE9E453F12305F24E89AB6C161A8D87F06DF0", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "tags_name_index", + "keys": [ + { + "type": "atom", + "value": "name" + } + ], + "name": "name", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "tags" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/update_campaign_targets/20241004162342.json b/backend/priv/resource_snapshots/repo/update_campaign_targets/20241004162342.json new file mode 100644 index 000000000..cb722cf0d --- /dev/null +++ b/backend/priv/resource_snapshots/repo/update_campaign_targets/20241004162342.json @@ -0,0 +1,275 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "status", + "type": "text" + }, + { + "allow_nil?": false, + "default": "0", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "retry_count", + "type": "bigint" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "latest_attempt", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "completion_timestamp", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "update_campaign_targets_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "id", + "destination_attribute_default": null, + "destination_attribute_generated": null, + "index?": true, + "match_type": "full", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "update_campaign_targets_update_campaign_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "update_campaigns" + }, + "size": null, + "source": "update_campaign_id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "id", + "destination_attribute_default": null, + "destination_attribute_generated": null, + "index?": true, + "match_type": "full", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "update_campaign_targets_device_id_fkey", + "on_delete": "nothing", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "devices" + }, + "size": null, + "source": "device_id", + "type": "bigint" + }, + { + "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": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "update_campaign_targets_ota_operation_id_fkey", + "on_delete": "nothing", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "ota_operations" + }, + "size": null, + "source": "ota_operation_id", + "type": "uuid" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "F480B1F79161C42937EF3273DA661AAF989E5DF7CE94C8A3EA6A241B3D7AEBBD", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "update_campaign_targets_unique_device_for_campaign_index", + "keys": [ + { + "type": "atom", + "value": "update_campaign_id" + }, + { + "type": "atom", + "value": "device_id" + } + ], + "name": "unique_device_for_campaign", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "update_campaign_targets" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/update_campaigns/20241004162342.json b/backend/priv/resource_snapshots/repo/update_campaigns/20241004162342.json new file mode 100644 index 000000000..e05ae1cb2 --- /dev/null +++ b/backend/priv/resource_snapshots/repo/update_campaigns/20241004162342.json @@ -0,0 +1,245 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "name", + "type": "text" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "status", + "type": "text" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "outcome", + "type": "text" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "rollout_mechanism", + "type": "map" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "start_timestamp", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": true, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "completion_timestamp", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "update_campaigns_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "id", + "destination_attribute_default": null, + "destination_attribute_generated": null, + "index?": true, + "match_type": "full", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "update_campaigns_base_image_id_fkey", + "on_delete": "nothing", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "base_images" + }, + "size": null, + "source": "base_image_id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "id", + "destination_attribute_default": null, + "destination_attribute_generated": null, + "index?": true, + "match_type": "full", + "match_with": { + "tenant_id": "tenant_id" + }, + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "name": "update_campaigns_update_channel_id_fkey", + "on_delete": "nothing", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "update_channels" + }, + "size": null, + "source": "update_channel_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "4213473CC0D3634DCD8B808B54B21AE689F4272DE36CF5C77131F60CDADDA61A", + "identities": [], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "update_campaigns" +} \ No newline at end of file diff --git a/backend/priv/resource_snapshots/repo/update_channels/20241004162342.json b/backend/priv/resource_snapshots/repo/update_channels/20241004162342.json new file mode 100644 index 000000000..1c92e80a5 --- /dev/null +++ b/backend/priv/resource_snapshots/repo/update_channels/20241004162342.json @@ -0,0 +1,172 @@ +{ + "attributes": [ + { + "allow_nil?": false, + "default": "nil", + "generated?": true, + "primary_key?": true, + "references": null, + "size": null, + "source": "id", + "type": "bigint" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "handle", + "type": "text" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "name", + "type": "text" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "inserted_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "fragment(\"(now() AT TIME ZONE 'utc')\")", + "generated?": false, + "primary_key?": false, + "references": null, + "size": null, + "source": "updated_at", + "type": "utc_datetime_usec" + }, + { + "allow_nil?": false, + "default": "nil", + "generated?": false, + "primary_key?": false, + "references": { + "deferrable": false, + "destination_attribute": "tenant_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": "update_channels_tenant_id_fkey", + "on_delete": "delete", + "on_update": null, + "primary_key?": true, + "schema": "public", + "table": "tenants" + }, + "size": null, + "source": "tenant_id", + "type": "bigint" + } + ], + "base_filter": null, + "check_constraints": [], + "custom_indexes": [ + { + "all_tenants?": false, + "concurrently": false, + "error_fields": [ + "id" + ], + "fields": [ + { + "type": "atom", + "value": "id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": true, + "using": null, + "where": null + }, + { + "all_tenants?": true, + "concurrently": false, + "error_fields": [ + "tenant_id" + ], + "fields": [ + { + "type": "atom", + "value": "tenant_id" + } + ], + "include": null, + "message": null, + "name": null, + "nulls_distinct": true, + "prefix": null, + "table": null, + "unique": false, + "using": null, + "where": null + } + ], + "custom_statements": [], + "has_create_action": true, + "hash": "84C23825E7DAA60B942B4EFACA04EDC9D8E73C23BCC60AC3D60372E52457EB2D", + "identities": [ + { + "all_tenants?": false, + "base_filter": null, + "index_name": "update_channels_handle_index", + "keys": [ + { + "type": "atom", + "value": "handle" + } + ], + "name": "handle", + "nils_distinct?": true, + "where": null + }, + { + "all_tenants?": false, + "base_filter": null, + "index_name": "update_channels_name_index", + "keys": [ + { + "type": "atom", + "value": "name" + } + ], + "name": "name", + "nils_distinct?": true, + "where": null + } + ], + "multitenancy": { + "attribute": "tenant_id", + "global": false, + "strategy": "attribute" + }, + "repo": "Elixir.Edgehog.Repo", + "schema": null, + "table": "update_channels" +} \ No newline at end of file