<?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 Version20201223115043 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('ALTER TABLE std_web_users ADD logintoken VARCHAR(32) DEFAULT NULL, ADD activationkey VARCHAR(100) DEFAULT NULL, ADD facebook_id VARCHAR(255) DEFAULT NULL, ADD facebook_integration TINYINT(1) DEFAULT NULL, ADD google_id VARCHAR(255) DEFAULT NULL, ADD google_integration TINYINT(1) DEFAULT NULL, ADD terms_accepted_at DATETIME DEFAULT NULL;');
$this->addSql('ALTER TABLE `std_web_users` ADD COLUMN `phone` VARCHAR(20) NULL DEFAULT NULL COLLATE \'utf8mb4_unicode_ci\' AFTER `terms_accepted_at`,
ADD COLUMN `mobile` VARCHAR(20) NULL DEFAULT NULL AFTER `phone`; ');
$this->addSql('ALTER TABLE `std_web_users` CHANGE COLUMN `username` `username` VARCHAR(100) NULL COMMENT \'Username used to login\' COLLATE \'utf8mb4_unicode_ci\' AFTER `name`;');
$this->addSql('ALTER TABLE `std_web_users` CHANGE COLUMN `is_locked` `is_locked` TINYINT(1) NULL DEFAULT \'0\' COMMENT \'Flag to lock the user\' AFTER `language`,
CHANGE COLUMN `is_super_user` `is_super_user` TINYINT(1) NULL DEFAULT \'0\' COMMENT \'Flag indicating super user privileges\' AFTER `is_locked`,
CHANGE COLUMN `is_deleted` `is_deleted` TINYINT(1) NULL DEFAULT \'0\' COMMENT \'Flag that indicates the user has been deleted\' AFTER `is_super_user`,
CHANGE COLUMN `roles` `roles` JSON NULL AFTER `updated_date`;');
$this->addSql('ALTER TABLE `std_web_users`
ADD COLUMN `vat` VARCHAR(50) NULL DEFAULT NULL COMMENT \'User vat number\' AFTER `mobile`;');
$this->addSql("INSERT INTO `std_blocks` (`created_by`, `updated_by`, `machine_name`, `created_date`, `updated_date`, `name`, `settings`) VALUES ('1', '1', 'register_web_users', '2020-12-23 13:04:02', '2020-12-23 13:04:03', 'Registo Utilizador', '{\"isWebUsersRegistration\":true}');");
$this->addSql("
SET @id_block = LAST_INSERT_ID();
INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `is_active`, `created_date`, `updated_date`, `name`, `is_repeatable`) VALUES ('title', @id_block, 1, 1, 'INPUT', NULL, 1, 1, '2021-01-04 19:18:16', '2021-01-04 19:18:16', 'Title', 0);
INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `is_active`, `created_date`, `updated_date`, `name`, `is_repeatable`) VALUES ('address1', @id_block, 1, 1, 'CHECKBOX', NULL, 1, 1, '2021-01-04 19:18:16', '2021-01-04 19:18:16', 'Include Billing Address', 0);
INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `is_active`, `created_date`, `updated_date`, `name`, `is_repeatable`) VALUES ('address2', @id_block, 1, 1, 'CHECKBOX', NULL, 1, 1, '2021-01-04 19:18:16', '2021-01-04 19:18:16', 'Include Delivery Address', 0);
INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `is_active`, `created_date`, `updated_date`, `name`, `is_repeatable`) VALUES ('activation', @id_block, 1, 1, 'CHECKBOX', NULL, 1, 1, '2021-01-04 19:18:16', '2021-01-04 19:18:16', 'Require Activation', 0);
INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `settings`, `order_value`, `is_active`, `created_date`, `updated_date`, `name`, `is_repeatable`) VALUES ('redirectto', @id_block, 1, 1, 'INPUT', NULL, 1, 1, '2021-01-04 19:18:16', '2021-01-04 19:18:16', 'Redirect to', 0);
INSERT INTO `std_blocks_settings` (`machine_name`, `block_id`, `created_by`, `updated_by`, `name`, `setting_type`, `is_active`, `created_date`, `updated_date`, `order_value`, `settings`) VALUES ('disabled_block', @id_block, 1, 1, 'Disabled block', 'CHECKBOX', 1, '2020-06-22 15:27:32', '2020-06-22 15:27:32', -1, NULL);
INSERT INTO `std_blocks` (`created_by`, `updated_by`, `machine_name`, `created_date`, `updated_date`, `name`) VALUES ('1', '1', 'login', '2021-01-07 15:42:47', '2021-01-07 15:42:47', 'Login Utilizadores');
SET @id_block = LAST_INSERT_ID();
INSERT INTO `std_blocks_components` (`machine_name`, `block_id`, `created_by`, `updated_by`, `component_type`, `order_value`, `created_date`, `updated_date`, `name`) VALUES ('redirectto', @id_block, '1', '1', 'INPUT', '1', '2021-01-07 15:46:30', '2021-01-07 15:46:31', 'Redirect to');
INSERT INTO `std_blocks_settings` (`machine_name`, `block_id`, `created_by`, `updated_by`, `name`, `setting_type`, `is_active`, `created_date`, `updated_date`, `order_value`, `settings`) VALUES ('disabled_block', @id_block, 1, 1, 'Disabled block', 'CHECKBOX', 1, '2020-06-22 15:27:32', '2020-06-22 15:27:32', -1, NULL);
");
}
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('ALTER TABLE `std_web_users` CHANGE COLUMN `is_locked` `is_locked` TINYINT(1) NOT NULL COMMENT \'Flag to lock the user\' AFTER `language`,
CHANGE COLUMN `is_super_user` `is_super_user` TINYINT(1) NOT NULL COMMENT \'Flag indicating super user privileges\' AFTER `is_locked`,
CHANGE COLUMN `is_deleted` `is_deleted` TINYINT(1) NOT NULL COMMENT \'Flag that indicates the user has been deleted\' AFTER `is_super_user`,
CHANGE COLUMN `roles` `roles` JSON NOT NULL AFTER `updated_date`;');
$this->addSql('ALTER TABLE `std_web_users` CHANGE COLUMN `username` `username` VARCHAR(100) NOT NULL COMMENT \'Username used to login\' COLLATE \'utf8mb4_unicode_ci\' AFTER `name`;');
$this->addSql('ALTER TABLE std_web_users DROP logintoken, DROP activationkey, DROP facebook_id, DROP facebook_integration, DROP google_id, DROP google_integration, DROP terms_accepted_at, DROP phone, DROP mobile, DROP vat;');
$this->addSql("delete from std_blocks_components where block_id=(select id from std_blocks where machine_name='register_web_users')");
$this->addSql("delete from std_blocks_settings where block_id=(select id from std_blocks where machine_name='register_web_users')");
$this->addSql("delete from std_blocks where machine_name='register_web_users'");
$this->addSql("delete from std_blocks_components where block_id=(select id from std_blocks where machine_name='login')");
$this->addSql("delete from std_blocks_settings where block_id=(select id from std_blocks where machine_name='login')");
$this->addSql("delete from std_blocks where machine_name='login'");
}
}