migrations/Version20210520130148.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 Version20210520130148 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         
  20.         $this->addSql("SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='web_users_detail');");
  21.         $this->addSql("INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `created_date`, `updated_date`, `name`, `is_repeatable`) VALUES 
  22.             ('editable', @block_id, '1', '1', 'CHECKBOX', null , 20, now(), now(), 'Editável?', 0),
  23.             ('show_name', @block_id, '1', '1', 'CHECKBOX', null , 30, now(), now(), 'Mostrar nome?', 0),
  24.             ('required_name', @block_id, '1', '1', 'CHECKBOX', null , 35, now(), now(), 'Nome obrigatório?', 0),
  25.             ('show_username', @block_id, '1', '1', 'CHECKBOX', null , 40, now(), now(), 'Mostrar username?', 0),
  26.             ('required_username', @block_id, '1', '1', 'CHECKBOX', null , 45, now(), now(), 'Username obrigatório?', 0),
  27.             ('show_email', @block_id, '1', '1', 'CHECKBOX', null , 50, now(), now(), 'Mostrar e-mail?', 0),
  28.             ('required_email', @block_id, '1', '1', 'CHECKBOX', null , 55, now(), now(), 'E-mail obrigatório?', 0),
  29.             ('show_phone', @block_id, '1', '1', 'CHECKBOX', null , 60, now(), now(), 'Mostrar telefone?', 0),
  30.             ('required_phone', @block_id, '1', '1', 'CHECKBOX', null , 60, now(), now(), 'Telefone obrigatório?', 0),
  31.             ('show_mobile', @block_id, '1', '1', 'CHECKBOX', null , 70, now(), now(), 'Mostrar telemóvel?', 0),
  32.             ('required_mobile', @block_id, '1', '1', 'CHECKBOX', null , 75, now(), now(), 'Telemóvel obrigatório?', 0),
  33.             ('show_vat', @block_id, '1', '1', 'CHECKBOX', null , 80, now(), now(), 'Mostrar NIF?', 0),
  34.             ('required_vat', @block_id, '1', '1', 'CHECKBOX', null , 85, now(), now(), 'NIF obrigatório?', 0),
  35.             ('info_name', @block_id, '1', '1', 'INPUT', null , 90, now(), now(), 'Nome campo', 1),
  36.             ('info_type', @block_id, '1', '1', 'COMBO', '{\"data\": [{\"Text\": \"text\"},{\"E-mail\": \"email\"}], \"type\": \"static\", \"default\": \"text\"}' , 91, now(), now(), 'Tipo de campo', 1),
  37.             ('info_required', @block_id, '1', '1', 'CHECKBOX', null , 93, now(), now(), 'Campo obrigatório?', 1)
  38.         ;");
  39.         $this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
  40.         $this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Dados pessoais');");
  41.         $this->addSql("UPDATE `std_pages_content` SET `content`='{\"fields\": {\"1\": {\"skin\": \"\", \"block\": \"web_users_detail\", \"isMaster\": 0, \"settings\": {\"expire_date\": \"\", \"publish_date\": \"\"}, \"blockname\": \"\", \"components\": {\"title\": \"Os meus dados\", \"editable\": \"1\", \"show_vat\": \"1\", \"show_name\": \"1\", \"show_email\": \"1\", \"show_phone\": \"1\", \"show_mobile\": \"1\", \"required_vat\": \"0\", \"required_name\": \"1\", \"show_username\": \"0\", \"required_email\": \"1\", \"required_phone\": \"0\", \"required_mobile\": \"0\", \"required_username\": \"0\"}, \"repeatable\": [], \"templatesBlocksId\": 0}}}' WHERE `page_id`=@child_page;");
  42.         
  43.         $this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
  44.         $this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Área reservada');");
  45.         $this->addSql("UPDATE `std_pages_content` SET `content`='{\"fields\": {\"1\": {\"skin\": \"\", \"block\": \"web_users_detail\", \"isMaster\": 0, \"settings\": {\"expire_date\": \"\", \"publish_date\": \"\"}, \"blockname\": \"\", \"components\": {\"title\": \"Os meus dados\", \"editable\": \"1\", \"show_vat\": \"1\", \"show_name\": \"1\", \"show_email\": \"1\", \"show_phone\": \"1\", \"show_mobile\": \"1\", \"required_vat\": \"0\", \"required_name\": \"1\", \"show_username\": \"0\", \"required_email\": \"1\", \"required_phone\": \"0\", \"required_mobile\": \"0\", \"required_username\": \"0\"}, \"repeatable\": [], \"templatesBlocksId\": 0}}}' WHERE `page_id`=@child_page;");
  46.     }
  47.     
  48.     public function down(Schema $schema) : void
  49.     {
  50.         // this down() migration is auto-generated, please modify it to your needs
  51.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  52.         
  53.         $this->addSql("SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='web_users_detail');");
  54.         $this->addSql("DELETE FROM `std_blocks_components` WHERE `block_id`=@block_id 
  55.         AND `machine_name` IN('editable','show_name','required_name','show_username','required_username','show_email','required_email','show_phone','required_phone','show_mobile','required_mobile','show_vat','required_vat','info_name','info_type','info_required');");
  56.         $this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
  57.         $this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Dados pessoais');");
  58.         $this->addSql("UPDATE `std_pages_content` SET `content`='{\"fields\": {\"1\": {\"skin\": \"\", \"block\": \"web_users_detail\", \"isMaster\": 0, \"settings\": {\"expire_date\": \"\", \"publish_date\": \"\"}, \"blockname\": \"\", \"components\": {\"title\": \"Os meus dados\"}, \"repeatable\": [], \"templatesBlocksId\": 0}}}' WHERE `page_id`=@child_page;");
  59.         $this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
  60.         $this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Área reservada');");
  61.         $this->addSql("UPDATE `std_pages_content` SET `content`='{\"fields\": {\"1\": {\"skin\": \"\", \"block\": \"web_users_detail\", \"isMaster\": 0, \"settings\": {\"expire_date\": \"\", \"publish_date\": \"\"}, \"blockname\": \"\", \"components\": {\"title\": \"Os meus dados\"}, \"repeatable\": [], \"templatesBlocksId\": 0}}}' WHERE `page_id`=@child_page;");
  62.     }
  63. }