From 4ac6b2a8d36dc0e1618f89c4452b3812bbd77753 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sun, 9 Aug 2026 17:25:32 +0100 Subject: [PATCH 1/4] Fix PostgreSQL enum column padding --- ...um_char_columns_to_varchar_on_postgres.php | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 database/migrations/2026_08_09_000001_change_enum_char_columns_to_varchar_on_postgres.php diff --git a/database/migrations/2026_08_09_000001_change_enum_char_columns_to_varchar_on_postgres.php b/database/migrations/2026_08_09_000001_change_enum_char_columns_to_varchar_on_postgres.php new file mode 100644 index 00000000..c23b19a8 --- /dev/null +++ b/database/migrations/2026_08_09_000001_change_enum_char_columns_to_varchar_on_postgres.php @@ -0,0 +1,45 @@ +string('order_direction', 4)->nullable()->change(); + }); + + Schema::table('incident_templates', function (Blueprint $table) { + $table->string('engine')->default('twig')->change(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + if (DB::getDriverName() !== 'pgsql') { + return; + } + + Schema::table('component_groups', function (Blueprint $table) { + $table->char('order_direction', 4)->nullable()->change(); + }); + + Schema::table('incident_templates', function (Blueprint $table) { + $table->char('engine')->default('twig')->change(); + }); + } +}; From 6bd966b58cb46e215bd47bfd01e10c259f274ba8 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sun, 9 Aug 2026 17:25:52 +0100 Subject: [PATCH 2/4] Fix PostgreSQL enum column padding --- ...1_121458_add_ordering_cols_to_component_groups_table.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/database/migrations/2025_01_21_121458_add_ordering_cols_to_component_groups_table.php b/database/migrations/2025_01_21_121458_add_ordering_cols_to_component_groups_table.php index cacf4cc0..f7095b5c 100644 --- a/database/migrations/2025_01_21_121458_add_ordering_cols_to_component_groups_table.php +++ b/database/migrations/2025_01_21_121458_add_ordering_cols_to_component_groups_table.php @@ -15,7 +15,11 @@ public function up(): void { Schema::table('component_groups', function (Blueprint $table) { $table->string('order_column')->nullable()->after('order'); - $table->char('order_direction', 4)->nullable()->after('order_column'); + if (DB::getDriverName() === 'pgsql') { + $table->string('order_direction', 4)->nullable()->after('order_column'); + } else { + $table->char('order_direction', 4)->nullable()->after('order_column'); + } }); DB::table('component_groups')->update(['order_column' => ResourceOrderColumnEnum::Manual->value]); From 1daf2703008dc8a896c19c2dca4bc29209c77738 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sun, 9 Aug 2026 17:25:53 +0100 Subject: [PATCH 3/4] Fix PostgreSQL enum column padding --- ...05838_add_engine_column_to_incident_templates_table.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/database/migrations/2023_09_18_105838_add_engine_column_to_incident_templates_table.php b/database/migrations/2023_09_18_105838_add_engine_column_to_incident_templates_table.php index 10467f95..851a83f8 100644 --- a/database/migrations/2023_09_18_105838_add_engine_column_to_incident_templates_table.php +++ b/database/migrations/2023_09_18_105838_add_engine_column_to_incident_templates_table.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration @@ -12,7 +13,11 @@ public function up(): void { Schema::table('incident_templates', function (Blueprint $table) { - $table->char('engine')->default('twig')->after('template'); + if (DB::getDriverName() === 'pgsql') { + $table->string('engine')->default('twig')->after('template'); + } else { + $table->char('engine')->default('twig')->after('template'); + } }); } }; From f6a50553b0809f0540d15a1e591ab99e1bf2f0a5 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Sun, 9 Aug 2026 17:25:54 +0100 Subject: [PATCH 4/4] Add ascending order direction coverage --- tests/Feature/Api/ComponentGroupTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Feature/Api/ComponentGroupTest.php b/tests/Feature/Api/ComponentGroupTest.php index 89928c6d..d9bfb4ba 100644 --- a/tests/Feature/Api/ComponentGroupTest.php +++ b/tests/Feature/Api/ComponentGroupTest.php @@ -367,6 +367,20 @@ ]); }); +it('exposes an ascending order direction in the resource', function () { + $componentGroup = ComponentGroup::factory() + ->orderedBy(ResourceOrderColumnEnum::Name, ResourceOrderDirectionEnum::Asc) + ->create(); + + $response = getJson('/status/api/component-groups/'.$componentGroup->id); + + $response->assertOk(); + $response->assertJsonFragment([ + 'order_column' => ResourceOrderColumnEnum::Name->value, + 'order_direction' => ResourceOrderDirectionEnum::Asc->value, + ]); +}); + it('can create a component group with a manual order column', function () { Sanctum::actingAs(User::factory()->create(), ['component-groups.manage']);