migrations/Version20250602134955.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.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20250602134955 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $now = (new \DateTime())->format('Y-m-d H:i:s');
  18.         // Insert menu options
  19.         $this->addSql("
  20.             INSERT INTO std_options (created_by, updated_by, machine_name, order_value, path, is_active, created_date, updated_date, menu_section, dropdown_section, icon, name, external_link)
  21.             VALUES
  22.             -- Header: Areas
  23.             (1, 1, 'see_website', 1, null, 1, '$now', '$now', 'areas', null, 'web', 'see_website', '/'),
  24.             (1, 1, 'workspace', 2, 'admin_workspace', 1, '$now', '$now', 'areas', null, 'device-desktop', 'workspace', null),
  25.             (1, 1, 'studiohelp', 3, null, 1, '$now', '$now', 'areas', null, 'information', 'studiohelp', 'https://studio.help.fullscreen.pt'),
  26.             -- Navigation
  27.             (1, 1, 'navigation', 4, 'admin_navigation_initial_relation', 1, '$now', '$now', 'navigation', null, 'network-1', 'navigation', null),
  28.             -- Approvals
  29.             (1, 1, 'approval_workflow', 4, 'admin_approvals', 1, '$now', '$now', 'navigation', null, 'search', 'approval_workflow', null),
  30.             
  31.             -- Content
  32.             (1, 1, 'pages', 5, null, 1, '$now', '$now', 'navigation', 'content', 'blog', 'pages', '/admin/content/pages'),
  33.             (1, 1, 'posts', 6, null, 1, '$now', '$now', 'navigation', 'content', 'blog', 'posts', '/admin/content/posts'),
  34.             (1, 1, 'landing_pages', 7, null, 1, '$now', '$now', 'navigation', 'content', 'blog', 'landing_pages', '/admin/content/landing_pages'),
  35.             (1, 1, 'modals', 8, null, 1, '$now', '$now', 'navigation', 'content', 'blog', 'modals', '/admin/content/modals'),
  36.             (1, 1, 'content_snippets', 9, 'admin_snippets', 1, '$now', '$now', 'navigation', 'content', 'blog', 'content_snippets', null),
  37.             
  38.             (1, 1, 'pages_categories', 10, null, 1, '$now', '$now', 'navigation', null, 'network-1', 'categories', '/admin/content/pages_categories'),
  39.             (1, 1, 'seo', 11, 'admin_seo', 1, '$now', '$now', 'navigation', null, 'graph-line', 'seo', null),
  40.             (1, 1, 'system', 12, null, 1, '$now', '$now', 'navigation', null, 'gear', 'system', '/admin/content/system'),
  41.             -- Forms
  42.             (1, 1, 'all_forms', 13, null, 1, '$now', '$now', 'navigation', 'forms', 'document', 'all_forms', '/admin/content/forms'),
  43.             (1, 1, 'submitted_forms', 14, null, 1, '$now', '$now', 'navigation', 'forms', 'document', 'submitted_forms', '/admin/forms'),
  44.             -- Domains & Webservices
  45.             (1, 1, 'domains', 15, 'admin_domains', 1, '$now', '$now', 'navigation', null, 'network-3', 'domains', null),
  46.             (1, 1, 'webservices', 16, 'admin_webservices', 1, '$now', '$now', 'navigation', null, 'browser-upload', 'webservices', null),
  47.             -- Menus & Templates
  48.             (1, 1, 'menus', 17, 'admin_menus', 1, '$now', '$now', 'navigation', null, 'view-list', 'menus', null),
  49.             (1, 1, 'templates', 18, 'admin_templates', 1, '$now', '$now', 'navigation', null, 'align-left', 'templates', null),
  50.             (1, 1, 'attributes', 19, 'admin_attributes', 1, '$now', '$now', 'navigation', null, 'checklist', 'attributes', null),
  51.             -- Notifications
  52.             (1, 1, 'notifications', 20, 'admin_notifications', 1, '$now', '$now', 'navigation', 'notifications', 'mail', 'all_notifications', null),
  53.             (1, 1, 'emails_config', 21, 'admin_emails_configurations', 1, '$now', '$now', 'navigation', 'notifications', 'gear', 'all_emails_configurations', null),
  54.             -- Filemanager
  55.             (1, 1, 'filemanager', 22, null, 1, '$now', '$now', 'navigation', null, 'archive', 'file_manager', '/admin/filemanager/?conf=default'),
  56.             -- Translations
  57.             (1, 1, 'languages', 23, 'admin_languages_list', 1, '$now', '$now', 'navigation', 'translations', 'web', 'languages', null),
  58.             (1, 1, 'translations', 24, 'admin_translations', 1, '$now', '$now', 'navigation', 'translations', 'web', 'translations', null),
  59.             (1, 1, 'add_translation', 25, 'admin_translations_new', 1, '$now', '$now', 'navigation', 'translations', 'web', 'add_new', null),
  60.             (1, 1, 'refresh_labels', 26, null, 1, '$now', '$now', 'navigation', 'translations', 'web', 'refresh_labels', '/admin/translations/refresh'),
  61.             -- Scheduler
  62.             (1, 1, 'scheduler_tasks', 27, 'scheduler_tasks', 1, '$now', '$now', 'navigation', 'scheduled_tasks', 'clock', 'list_scheduled_tasks', null),
  63.             (1, 1, 'scheduler_tasks_new', 27, 'scheduler_tasks_new', 1, '$now', '$now', 'navigation', 'scheduled_tasks', 'clock', 'add_scheduled_tasks', null),
  64.             
  65.             -- Cache
  66.             (1, 1, 'clear_html_cache', 28, null, 1, '$now', '$now', 'administration', 'cache', 'clockwise', 'clear_html_cache', '/admin/cache/clear'),
  67.             (1, 1, 'clear_liip_cache', 29, null, 1, '$now', '$now', 'administration', 'cache', 'clockwise', 'clear_liip_cache', '/admin/liip/cache/clear'),
  68.             
  69.             -- Users
  70.             (1, 1, 'users', 30, 'admin_users', 1, '$now', '$now', 'administration', null, 'user-group', 'users', null),
  71.             (1, 1, 'delete_user_data', 31, 'admin_delete_user_data', 1, '$now', '$now', 'administration', null, 'user-group', 'delete_user_data', null),
  72.             
  73.             -- Redirects
  74.             (1, 1, 'redirects', 32, 'admin_redirects', 1, '$now', '$now', 'administration', null, 'skip', 'redirects', null),
  75.             
  76.             -- Emails Log
  77.             (1, 1, 'emails_log_all', 33, 'admin_emailslog', 1, '$now', '$now', 'administration', 'emails_log', 'mail', 'all_emails_log', null),
  78.             (1, 1, 'emails_log_error', 34, 'admin_emailslog_with_error', 1, '$now', '$now', 'administration', 'emails_log', 'mail', 'emails_log_error', null),
  79.             
  80.             -- Settings
  81.             (1, 1, 'settings', 35, 'admin_config', 1, '$now', '$now', 'administration', null, 'toggles', 'settings', null),
  82.             (1, 1, 'roles', 36, 'admin_roles', 1, '$now', '$now', 'administration', null, 'user-group', 'permissions', null),
  83.                 
  84.             -- Super Admin
  85.             (1, 1, 'feature_flag', 37, 'admin_feature_flag_list', 1, '$now', '$now', 'administration', null, 'flag', 'feature_flag', null),
  86.             (1, 1, 'master_config', 38, 'admin_masterconfig', 1, '$now', '$now', 'administration', null, 'toggles', 'master_config', null);
  87.             ");
  88.     }
  89.     public function down(Schema $schema): void
  90.     {
  91.         // this down() migration is auto-generated, please modify it to your needs
  92.         $this->addSql('DROP TABLE cache_items');
  93.         $this->addSql('ALTER TABLE std_config CHANGE roles roles JSON DEFAULT NULL');
  94.         $this->addSql('CREATE UNIQUE INDEX idx_machine_name ON std_content_types (machine_name)');
  95.         $this->addSql('ALTER TABLE std_cookies CHANGE webuser_id webuser_id INT UNSIGNED DEFAULT NULL COMMENT \'Web user unique identifider\', CHANGE funcional_accepted funcional_accepted TINYINT(1) DEFAULT 0 NOT NULL COMMENT \'Funcional cookies accepted\'');
  96.         $this->addSql('ALTER TABLE std_diary CHANGE created_by created_by INT UNSIGNED DEFAULT NULL, CHANGE updated_by updated_by INT UNSIGNED DEFAULT NULL, CHANGE type type VARCHAR(255) CHARACTER SET utf8mb3 NOT NULL COLLATE `utf8mb3_general_ci`, CHANGE subtype subtype VARCHAR(255) CHARACTER SET utf8mb3 NOT NULL COLLATE `utf8mb3_general_ci`');
  97.         $this->addSql('ALTER TABLE std_diary RENAME INDEX idx_d245bcffde12ab56 TO FK_CreatedByUser');
  98.         $this->addSql('ALTER TABLE std_diary RENAME INDEX idx_d245bcff16fe72e1 TO FK_UpdatedByUser');
  99.         $this->addSql('ALTER TABLE std_domains_values DROP FOREIGN KEY FK_3A0935D7115F0EE5');
  100.         $this->addSql('ALTER TABLE std_domains_values ADD CONSTRAINT FK_3A0935D7115F0EE5 FOREIGN KEY (domain_id) REFERENCES std_domains (id) ON UPDATE NO ACTION ON DELETE CASCADE');
  101.         $this->addSql('ALTER TABLE std_domains_values_content CHANGE language_code language_code VARCHAR(2) NOT NULL');
  102.         $this->addSql('ALTER TABLE std_domains_values_content RENAME INDEX idx_b090d5cb451cdad4 TO FK_std_domains_values_content_std_languages');
  103.         $this->addSql('CREATE INDEX idx_address ON std_emails_log (toaddress(100))');
  104.         $this->addSql('CREATE INDEX idx_created ON std_emails_log (created_at)');
  105.         $this->addSql('ALTER TABLE std_feature_flag CHANGE info info JSON NOT NULL COMMENT \'info of feature flag\'');
  106.         $this->addSql('ALTER TABLE std_languages CHANGE order_value order_value INT DEFAULT NULL');
  107.         $this->addSql('CREATE UNIQUE INDEX locale ON std_languages (locale)');
  108.         $this->addSql('ALTER TABLE std_options DROP dropdown_section');
  109.         $this->addSql('ALTER TABLE std_pages CHANGE machine_name machine_name VARCHAR(255) DEFAULT NULL COMMENT \'Page machine name\'');
  110.         $this->addSql('ALTER TABLE std_pages_content CHANGE meta_description meta_description VARCHAR(4000) DEFAULT NULL COMMENT \'Meta description of the page\', CHANGE og_description og_description VARCHAR(4000) DEFAULT NULL, CHANGE scripts_head scripts_head TEXT DEFAULT NULL COMMENT \'Scripts to add to the head of the page\', CHANGE scripts_body scripts_body TEXT DEFAULT NULL COMMENT \'Scripts to add to the body of the page\', CHANGE scripts_footer scripts_footer TEXT DEFAULT NULL COMMENT \'Scripts to add to the footer of the page\'');
  111.         $this->addSql('ALTER TABLE std_scheduler_commands CHANGE is_stoppable is_stoppable TINYINT(1) DEFAULT 0 COMMENT \'Flag that indictes if command can be stopped manually while running\'');
  112.         $this->addSql('CREATE UNIQUE INDEX machine_name ON std_scheduler_commands (machine_name)');
  113.         $this->addSql('ALTER TABLE std_scheduler_tasks CHANGE scheduler_command_id scheduler_command_id INT UNSIGNED NOT NULL COMMENT \'Command unique identifier\', CHANGE created_by created_by INT UNSIGNED NOT NULL COMMENT \'Unique identifier\', CHANGE updated_by updated_by INT UNSIGNED NOT NULL COMMENT \'Unique identifier\', CHANGE status status SMALLINT DEFAULT NULL COMMENT \'null - Never executed, 0 - running, -1 - error, 1 - success, 2 stopped\', CHANGE force_stop force_stop TINYINT(1) DEFAULT 0 COMMENT \'Flag that indictes the task should stop immediatly\', CHANGE force_start force_start TINYINT(1) DEFAULT 0 COMMENT \'Flag that indictes the task should start immediatly\', CHANGE is_deleted is_deleted TINYINT(1) DEFAULT 0 COMMENT \'Flag that indicates if the task is deleted\'');
  114.         $this->addSql('ALTER TABLE std_seo_benchmark CHANGE missing_content missing_content LONGTEXT DEFAULT NULL, CHANGE checked_pages checked_pages LONGTEXT DEFAULT NULL');
  115.         $this->addSql('CREATE UNIQUE INDEX label_domain ON std_translations (label, domain)');
  116.         $this->addSql('DROP INDEX translation_id_language_code ON std_translations_content');
  117.         $this->addSql('ALTER TABLE std_translations_content CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT \'Unique Identifier\', CHANGE translation_id translation_id INT UNSIGNED NOT NULL COMMENT \'Translation ID from table std_translations\', CHANGE language_code language_code VARCHAR(2) NOT NULL COMMENT \'ISO 639 Language code\', CHANGE content content VARCHAR(8000) DEFAULT NULL COMMENT \'ISO 639 Translation\'');
  118.         $this->addSql('CREATE UNIQUE INDEX translation_id_language_code ON std_translations_content (translation_id, language_code)');
  119.         $this->addSql('ALTER TABLE std_translations_content RENAME INDEX idx_5507c9d451cdad4 TO FK_std_translations_content_std_languages');
  120.     }
  121. }