<?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 Version20210520130148 extends AbstractMigration
{
public function getDescription() : string
{
return '';
}
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql("SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='web_users_detail');");
$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
('editable', @block_id, '1', '1', 'CHECKBOX', null , 20, now(), now(), 'Editável?', 0),
('show_name', @block_id, '1', '1', 'CHECKBOX', null , 30, now(), now(), 'Mostrar nome?', 0),
('required_name', @block_id, '1', '1', 'CHECKBOX', null , 35, now(), now(), 'Nome obrigatório?', 0),
('show_username', @block_id, '1', '1', 'CHECKBOX', null , 40, now(), now(), 'Mostrar username?', 0),
('required_username', @block_id, '1', '1', 'CHECKBOX', null , 45, now(), now(), 'Username obrigatório?', 0),
('show_email', @block_id, '1', '1', 'CHECKBOX', null , 50, now(), now(), 'Mostrar e-mail?', 0),
('required_email', @block_id, '1', '1', 'CHECKBOX', null , 55, now(), now(), 'E-mail obrigatório?', 0),
('show_phone', @block_id, '1', '1', 'CHECKBOX', null , 60, now(), now(), 'Mostrar telefone?', 0),
('required_phone', @block_id, '1', '1', 'CHECKBOX', null , 60, now(), now(), 'Telefone obrigatório?', 0),
('show_mobile', @block_id, '1', '1', 'CHECKBOX', null , 70, now(), now(), 'Mostrar telemóvel?', 0),
('required_mobile', @block_id, '1', '1', 'CHECKBOX', null , 75, now(), now(), 'Telemóvel obrigatório?', 0),
('show_vat', @block_id, '1', '1', 'CHECKBOX', null , 80, now(), now(), 'Mostrar NIF?', 0),
('required_vat', @block_id, '1', '1', 'CHECKBOX', null , 85, now(), now(), 'NIF obrigatório?', 0),
('info_name', @block_id, '1', '1', 'INPUT', null , 90, now(), now(), 'Nome campo', 1),
('info_type', @block_id, '1', '1', 'COMBO', '{\"data\": [{\"Text\": \"text\"},{\"E-mail\": \"email\"}], \"type\": \"static\", \"default\": \"text\"}' , 91, now(), now(), 'Tipo de campo', 1),
('info_required', @block_id, '1', '1', 'CHECKBOX', null , 93, now(), now(), 'Campo obrigatório?', 1)
;");
$this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
$this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Dados pessoais');");
$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;");
$this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
$this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Área reservada');");
$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;");
}
public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
$this->addSql("SET @block_id=(SELECT id FROM std_blocks WHERE machine_name='web_users_detail');");
$this->addSql("DELETE FROM `std_blocks_components` WHERE `block_id`=@block_id
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');");
$this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
$this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Dados pessoais');");
$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;");
$this->addSql("SET @privatearea_content_type = (SELECT id FROM std_content_types WHERE machine_name='private_area');");
$this->addSql("SET @child_page = (SELECT id FROM std_pages WHERE `content_type`=@privatearea_content_type AND name='Área reservada');");
$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;");
}
}