feat(form-builder): FormFieldValidationRuleService + legacy backfill + snapshot + library row-copy
This commit is contained in:
@@ -33,9 +33,10 @@ final class FormFieldBindingMigrationTest extends TestCase
|
||||
|
||||
public function test_forward_migrations_backfill_rows_from_both_json_sources(): void
|
||||
{
|
||||
// Roll back: create_form_field_validation_rules_table (WS-5b commit 1)
|
||||
// Roll back, newest first: backfill_form_field_validation_rules
|
||||
// → create_form_field_validation_rules_table (both WS-5b commit 1+2)
|
||||
// → drop_binding_json_columns → create_form_field_bindings.
|
||||
$this->artisan('migrate:rollback', ['--step' => 3])->assertSuccessful();
|
||||
$this->artisan('migrate:rollback', ['--step' => 4])->assertSuccessful();
|
||||
$this->assertFalse(Schema::hasTable('form_field_bindings'));
|
||||
$this->assertTrue(Schema::hasColumn('form_fields', 'binding'));
|
||||
$this->assertTrue(Schema::hasColumn('form_field_library', 'default_binding'));
|
||||
@@ -96,9 +97,10 @@ final class FormFieldBindingMigrationTest extends TestCase
|
||||
|
||||
public function test_rollback_reconstructs_json_and_drops_table(): void
|
||||
{
|
||||
// Walk back: validation-rules table (WS-5b commit 1) →
|
||||
// drop_binding_json_columns → create_form_field_bindings.
|
||||
$this->artisan('migrate:rollback', ['--step' => 3])->assertSuccessful();
|
||||
// Walk back the full WS-5b + WS-5a stack: backfill (validation rules)
|
||||
// → create (validation rules table) → drop (binding columns) →
|
||||
// create (bindings table).
|
||||
$this->artisan('migrate:rollback', ['--step' => 4])->assertSuccessful();
|
||||
[$fieldAId, , ] = $this->seedFieldsWithBindingJson();
|
||||
[$libAId, ] = $this->seedLibraryWithBindingJson();
|
||||
|
||||
@@ -108,9 +110,9 @@ final class FormFieldBindingMigrationTest extends TestCase
|
||||
$this->assertFalse(Schema::hasColumn('form_fields', 'binding'));
|
||||
$this->assertSame(5, DB::table('form_field_bindings')->count());
|
||||
|
||||
// Step back over WS-5b validation-rules table → irrelevant to the
|
||||
// binding contract, but restores the pre-WS-5b state.
|
||||
$this->artisan('migrate:rollback', ['--step' => 1])->assertSuccessful();
|
||||
// Step back over the two WS-5b migrations → restores the pre-WS-5b
|
||||
// state (validation-rules table gone; binding contract intact).
|
||||
$this->artisan('migrate:rollback', ['--step' => 2])->assertSuccessful();
|
||||
$this->assertFalse(Schema::hasTable('form_field_validation_rules'));
|
||||
$this->assertTrue(Schema::hasTable('form_field_bindings'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user