20260501130000_create_app_settings.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. declare(strict_types=1);
  3. use App\Infrastructure\Db\Migrations\BaseMigration;
  4. /**
  5. * Runtime-mutable feature flags. SPEC §M12.5 settings page is otherwise
  6. * read-only of env config; a small key/value table here lets admins
  7. * toggle feature flags (e.g. audit emission for high-volume public
  8. * endpoints) without restarting the api container.
  9. *
  10. * Seeds the two audit-emission flags as enabled. Defaults at the
  11. * application layer mirror these so a missing row is treated as enabled.
  12. */
  13. final class CreateAppSettings extends BaseMigration
  14. {
  15. public function change(): void
  16. {
  17. $table = $this->table('app_settings', ['id' => false, 'primary_key' => ['key']]);
  18. $table
  19. ->addColumn('key', 'string', ['limit' => 64, 'null' => false])
  20. ->addColumn('value', 'text', ['null' => true]);
  21. $this->addTimestampColumn($table, 'updated_at');
  22. $table->create();
  23. $this->table('app_settings')->insert([
  24. ['key' => 'audit_report_received_enabled', 'value' => '1'],
  25. ['key' => 'audit_blocklist_request_enabled', 'value' => '1'],
  26. ])->saveData();
  27. }
  28. }