migrations/Version20251103191211.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Add StdConfig entry for page audit content types filter
  8.  */
  9. final class Version20251103191211 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Add configuration entry to control which content types should be audited for page edit tracking';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // Insert config entry for page audit content types
  18.         $this->addSql("
  19.             INSERT INTO std_config (
  20.                 machine_name,
  21.                 label,
  22.                 value,
  23.                 description_machine_name,
  24.                 details_machine_name,
  25.                 parent_name,
  26.                 created_date,
  27.                 updated_date,
  28.                 created_by,
  29.                 updated_by,
  30.                 is_hidden,
  31.                 language_code,
  32.                 content,
  33.                 roles,
  34.                 variable_type,
  35.                 order_value
  36.             ) VALUES (
  37.                 'page_audit_content_types',
  38.                 'Page Audit - Content Types',
  39.                 NULL,
  40.                 'page_audit_content_types_description',
  41.                 'page_audit_content_types_details',
  42.                 'System',
  43.                 NOW(),
  44.                 NOW(),
  45.                 1,
  46.                 1,
  47.                 0,
  48.                 '',
  49.                 '{\"query\": \"select id, name as label from std_content_types order by name\"}',
  50.                 '[\"ROLE_SUPER_ADMIN\"]',
  51.                 'SELECT_MULTIPLE',
  52.                 99
  53.             )
  54.         ");
  55.     }
  56.     public function down(Schema $schema): void
  57.     {
  58.         // Remove the config entry
  59.         $this->addSql("DELETE FROM std_config WHERE machine_name = 'page_audit_content_types'");
  60.     }
  61. }