feat(form-builder): add failure_response_code column to form_submissions
Per RFC-WS-6 §Q3 v1.3 addition 2 + ARCH-BINDINGS §7.1 v1.2. Denormalised mirror of the FormBindingApplicatorException subclass classification, written by ApplyBindingsOnFormSubmit's outer-transaction catch block (D2) when apply_status='failed'. Drives response-shape copy. NULL when apply_status is not 'failed'. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Per RFC-WS-6 §Q3 v1.3 addition 2 + ARCH-BINDINGS §7.1 v1.2.
|
||||
*
|
||||
* Mirrors the FormBindingApplicatorException subclass classification onto
|
||||
* a denormalised string column for response-shape rendering. Values:
|
||||
* - schema_config_error (HTTP 422)
|
||||
* - temporary_error (HTTP 503)
|
||||
* - data_integrity_error (HTTP 422)
|
||||
* - unknown_error (HTTP 500)
|
||||
*
|
||||
* Read by the response renderer when apply_status='failed' to surface
|
||||
* contextual user-facing error copy. The exception subclass on the
|
||||
* action-failures row is the canonical source; this column is the
|
||||
* response-shape driver. Both reference the same submission.id ULID.
|
||||
*
|
||||
* NULL when apply_status is not 'failed' (per the lifecycle:
|
||||
* pending/completed/partial → no failure to classify).
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('form_submissions', function (Blueprint $table): void {
|
||||
$table->string('failure_response_code', 40)
|
||||
->nullable()
|
||||
->after('apply_status');
|
||||
|
||||
$table->index('failure_response_code', 'fs_failure_response_code_idx');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('form_submissions', function (Blueprint $table): void {
|
||||
$table->dropIndex('fs_failure_response_code_idx');
|
||||
$table->dropColumn('failure_response_code');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user