From f1c0e4e894766016f81bfc172e74bb4aa64a4a0a Mon Sep 17 00:00:00 2001 From: Matt Gros <3311227+mpge@users.noreply.github.com> Date: Tue, 5 May 2026 21:31:11 -0400 Subject: [PATCH 1/2] fix(migration): assign explicit name to custom_object_records linked index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The auto-generated index name `escalated_custom_object_records_linked_entity_type_linked_entity_id_index` is 73 characters — over PostgreSQL's 63-char identifier limit (NAMEDATALEN-1). Phoenix targets PostgreSQL primarily, so this would fail `mix ecto.migrate` for any user installing fresh today. Use an explicit short name (`custom_object_records_linked_idx`, 32 chars) following the same convention already used at line 61 (`name: :unique_field_entity`). Backwards compatible: the migration runs only once and is tracked in `schema_migrations`. Anyone for whom it succeeded already has the long auto-generated name; the new short name only applies to fresh installs. Anyone whose migration failed (PostgreSQL with default prefix) is unblocked. --- priv/repo/migrations/20260409000001_add_parity_gap_tables.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/priv/repo/migrations/20260409000001_add_parity_gap_tables.exs b/priv/repo/migrations/20260409000001_add_parity_gap_tables.exs index 8246026..a833d25 100644 --- a/priv/repo/migrations/20260409000001_add_parity_gap_tables.exs +++ b/priv/repo/migrations/20260409000001_add_parity_gap_tables.exs @@ -85,7 +85,7 @@ defmodule Escalated.Repo.Migrations.AddParityGapTables do end create index("#{@prefix}custom_object_records", [:custom_object_id]) - create index("#{@prefix}custom_object_records", [:linked_entity_type, :linked_entity_id]) + create index("#{@prefix}custom_object_records", [:linked_entity_type, :linked_entity_id], name: :custom_object_records_linked_idx) # Audit Logs create table("#{@prefix}audit_logs") do From 1603d4f6004072a01769bf28607092452a6de658 Mon Sep 17 00:00:00 2001 From: Matt Gros <3311227+mpge@users.noreply.github.com> Date: Tue, 5 May 2026 21:38:22 -0400 Subject: [PATCH 2/2] style: apply mix format to migration file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CI's `mix format --check-formatted` runs against PR-changed files in full. Wrapping the long `create index` line for the previous fix triggered the formatter to also wrap three pre-existing long lines in this file (`add :custom_field_id`, `add :custom_object_id`, `add :business_schedule_id`, and the `unique_index` for `custom_field_values`) — exactly the workflow's intent ("drift cleans up organically as files are touched", per `.github/workflows/lint.yml`). No semantic change. --- .../20260409000001_add_parity_gap_tables.exs | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/priv/repo/migrations/20260409000001_add_parity_gap_tables.exs b/priv/repo/migrations/20260409000001_add_parity_gap_tables.exs index a833d25..f750408 100644 --- a/priv/repo/migrations/20260409000001_add_parity_gap_tables.exs +++ b/priv/repo/migrations/20260409000001_add_parity_gap_tables.exs @@ -50,7 +50,9 @@ defmodule Escalated.Repo.Migrations.AddParityGapTables do # Custom Field Values create table("#{@prefix}custom_field_values") do - add :custom_field_id, references("#{@prefix}custom_fields", on_delete: :delete_all), null: false + add :custom_field_id, references("#{@prefix}custom_fields", on_delete: :delete_all), + null: false + add :entity_type, :string, default: "ticket" add :entity_id, :integer, null: false add :value, :text @@ -58,7 +60,11 @@ defmodule Escalated.Repo.Migrations.AddParityGapTables do timestamps(type: :utc_datetime) end - create unique_index("#{@prefix}custom_field_values", [:custom_field_id, :entity_type, :entity_id], name: :unique_field_entity) + create unique_index( + "#{@prefix}custom_field_values", + [:custom_field_id, :entity_type, :entity_id], + name: :unique_field_entity + ) # Custom Objects create table("#{@prefix}custom_objects") do @@ -75,7 +81,9 @@ defmodule Escalated.Repo.Migrations.AddParityGapTables do # Custom Object Records create table("#{@prefix}custom_object_records") do - add :custom_object_id, references("#{@prefix}custom_objects", on_delete: :delete_all), null: false + add :custom_object_id, references("#{@prefix}custom_objects", on_delete: :delete_all), + null: false + add :title, :string add :data, :map, default: %{} add :linked_entity_type, :string @@ -85,7 +93,10 @@ defmodule Escalated.Repo.Migrations.AddParityGapTables do end create index("#{@prefix}custom_object_records", [:custom_object_id]) - create index("#{@prefix}custom_object_records", [:linked_entity_type, :linked_entity_id], name: :custom_object_records_linked_idx) + + create index("#{@prefix}custom_object_records", [:linked_entity_type, :linked_entity_id], + name: :custom_object_records_linked_idx + ) # Audit Logs create table("#{@prefix}audit_logs") do @@ -119,7 +130,10 @@ defmodule Escalated.Repo.Migrations.AddParityGapTables do # Holidays create table("#{@prefix}holidays") do - add :business_schedule_id, references("#{@prefix}business_schedules", on_delete: :delete_all), null: false + add :business_schedule_id, + references("#{@prefix}business_schedules", on_delete: :delete_all), + null: false + add :name, :string, null: false add :date, :date, null: false add :is_recurring, :boolean, default: false