<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20190808093713 extends AbstractMigration
{
public function up(Schema $schema) : void
{
$this->addSql('CREATE TABLE std_notifications (id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT \'Notification unique identifier\', language_code VARCHAR(2) DEFAULT NULL COMMENT \'ISO 639 Language code\', name VARCHAR(255) DEFAULT NULL COMMENT \'Notification name\', machine_name VARCHAR(255) DEFAULT NULL COMMENT \'Notification machine name\', email_subject VARCHAR(255) NOT NULL COMMENT \'email subject\', email_body LONGTEXT NOT NULL COMMENT \'email body\', INDEX fk_std_notifications_std_languages (language_code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
$this->addSql('ALTER TABLE std_notifications ADD CONSTRAINT FK_233F326E451CDAD4 FOREIGN KEY (language_code) REFERENCES std_languages (language_code)');
$this->addSql("DELETE FROM `std_content_types_components` WHERE `content_type_id`=(SELECT id FROM std_content_types WHERE machine_name='forms')");
$this->addSql("INSERT INTO `std_content_types_skins` (`content_type_id`, `machine_name`, `name`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'render_form', 'Render Form', 1, 1, '2019-05-03 11:46:19', 1, '2019-05-03 11:46:19')");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_title', 'INPUT', 1, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25', 'Title', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_subtitle', 'INPUT', 2, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25', 'Subtitle', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_name', 'INPUT', 3, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25', 'Name', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_sender', 'CHECKBOX', 4, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25', 'Email sender', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_input_email_to_send', 'INPUT', 5, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25', 'Field of email sender', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_from_name', 'INPUT', 6, 1, 1, '2019-08-08 11:25:03', 1, '2019-08-08 11:25:05', 'Email From Name', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_from', 'INPUT', 7, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25', 'Email From', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_notification_user', 'COMBO', 8, 1, 1, '2019-08-08 10:01:59', 1, '2019-08-08 10:02:02', 'User Notification', '{\"sql\": \"SELECT n.id AS codigo, n.name AS descricao FROM std_notifications n ORDER BY name\", \"type\": \"dynamic\"}')");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_notification_user_cc', 'INPUT', 9, 1, 1, '2019-08-08 11:13:44', 1, '2019-08-08 11:13:52', 'User Email CC', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_notification_user_bcc', 'INPUT', 10, 1, 1, '2019-08-08 11:14:28', 1, '2019-08-08 11:14:30', 'User Email BCC', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_notification_admin', 'COMBO', 11, 1, 1, '2019-08-08 10:01:59', 1, '2019-08-08 10:02:02', 'Admin Notification', '{\"sql\": \"SELECT n.id AS codigo, n.name AS descricao FROM std_notifications n ORDER BY name\", \"type\": \"dynamic\"}')");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_to', 'INPUT', 12, 1, 1, '2019-08-08 11:15:08', 1, '2019-08-08 11:15:09', 'Admin Email to', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_admin_cc', 'INPUT', 13, 1, 1, '2019-08-08 11:15:54', 1, '2019-08-08 11:15:55', 'Admin Email CC', NULL)");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`, `name`, `settings`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_admin_bcc', 'INPUT', 14, 1, 1, '2019-08-08 11:16:31', 1, '2019-08-08 11:16:33', 'Admin Email BCC', NULL)");
$this->addSql('ALTER TABLE std_friendly_url ADD is_canonical TINYINT(1) NOT NULL COMMENT \'Flag that indicates if the url is canonical\'');
$this->addSql('ALTER TABLE std_menus_friendly_url ADD language_code VARCHAR(2) DEFAULT NULL COMMENT \'ISO 639 Language code\', ADD page_id INT UNSIGNED DEFAULT NULL COMMENT \'Page unique identifier\'');
$this->addSql('ALTER TABLE std_menus_friendly_url ADD CONSTRAINT FK_C8AAC9F8451CDAD4 FOREIGN KEY (language_code) REFERENCES std_languages (language_code)');
$this->addSql('ALTER TABLE std_menus_friendly_url ADD CONSTRAINT FK_C8AAC9F8C4663E4 FOREIGN KEY (page_id) REFERENCES std_pages (id)');
$this->addSql('CREATE INDEX IDX_C8AAC9F8451CDAD4 ON std_menus_friendly_url (language_code)');
$this->addSql('CREATE INDEX IDX_C8AAC9F8C4663E4 ON std_menus_friendly_url (page_id)');
$this->addSql('ALTER TABLE std_pages_content CHANGE canonical_url canonical_url VARCHAR(500) DEFAULT NULL COMMENT \'Canonical URL\'');
$this->addSql("UPDATE std_blocks SET `settings`='{\"isPage\": true}' WHERE machine_name='block_page'");
}
public function down(Schema $schema) : void
{
$this->addSql('DROP TABLE std_notifications');
$this->addSql("DELETE FROM `std_content_types_components` WHERE `content_type_id`=(SELECT id FROM std_content_types WHERE machine_name='forms')");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_to','Email to', 'INPUT', 2, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25')");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_from','Email from', 'INPUT', 7, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25')");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_subject','Email subject', 'INPUT', 8, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25')");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_body','Email body', 'TEXTAREA', 9, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25')");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_admin_subject','Admin email subject', 'INPUT', 10, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25')");
$this->addSql("INSERT INTO `std_content_types_components` (`content_type_id`, `machine_name`, `name`, `component_type`, `order_value`, `is_active`, `created_by`, `created_date`, `updated_by`, `updated_date`) VALUES ((SELECT id FROM std_content_types WHERE machine_name='forms'), 'form_email_admin_body','Admin email body', 'TEXTAREA', 11, 1, 1, '2019-03-22 14:45:23', 1, '2019-03-22 14:45:25')");
$this->addSql('ALTER TABLE std_friendly_url DROP is_canonical');
$this->addSql('ALTER TABLE std_menus_friendly_url DROP FOREIGN KEY FK_C8AAC9F8451CDAD4');
$this->addSql('ALTER TABLE std_menus_friendly_url DROP FOREIGN KEY FK_C8AAC9F8C4663E4');
$this->addSql('DROP INDEX IDX_C8AAC9F8451CDAD4 ON std_menus_friendly_url');
$this->addSql('DROP INDEX IDX_C8AAC9F8C4663E4 ON std_menus_friendly_url');
$this->addSql('ALTER TABLE std_menus_friendly_url DROP language_code, DROP page_id');
$this->addSql('ALTER TABLE std_pages_content CHANGE canonical_url canonical_url VARCHAR(500) DEFAULT NULL COLLATE utf8mb4_unicode_ci COMMENT \'Canonical url of the page\'');
}
}