migrations/Version20201222123920.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 Version20201222123920 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.         $this->addSql('CREATE TABLE std_web_users_addresses (id INT UNSIGNED AUTO_INCREMENT NOT NULL COMMENT \'Unique identifier\', webuser_id INT UNSIGNED DEFAULT NULL COMMENT \'Unique identifier\', name VARCHAR(250) DEFAULT NULL COMMENT \'Address description\', address_line_1 VARCHAR(500) DEFAULT NULL COMMENT \'Address first line\', address_line_2 VARCHAR(500) DEFAULT NULL COMMENT \'Address second line\', zipcode_1 VARCHAR(50) DEFAULT NULL COMMENT \'Zipcode first part\', zipcode_2 VARCHAR(50) DEFAULT NULL COMMENT \'Zipcode second part\', city VARCHAR(50) DEFAULT NULL COMMENT \'Address city\', state VARCHAR(50) DEFAULT NULL COMMENT \'Address state\', country VARCHAR(100) DEFAULT NULL COMMENT \'Address country\', custom_fields JSON DEFAULT NULL COMMENT \'Json structure with custom fields\', is_billing TINYINT(1) DEFAULT NULL COMMENT \'Flag that indicates this is the user\'\'s billing address\', is_default TINYINT(1) DEFAULT NULL COMMENT \'Flag that indicates this is the user\'\'s default billing or shipping address depending on the is_billing column\', is_active TINYINT(1) DEFAULT \'1\' NOT NULL COMMENT \'Flag that indicates if the record is active\', created_date DATETIME NOT NULL COMMENT \'Date and time of the record creation\', updated_date DATETIME NOT NULL COMMENT \'Date and time the record was last updated\', INDEX FK__std_web_users (webuser_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB');
  20.         $this->addSql('ALTER TABLE std_web_users_addresses ADD CONSTRAINT FK_6321161549279951 FOREIGN KEY (webuser_id) REFERENCES std_web_users (id)');
  21.     }
  22.     public function down(Schema $schema) : void
  23.     {
  24.         // this down() migration is auto-generated, please modify it to your needs
  25.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  26.         $this->addSql('DROP TABLE std_web_users_addresses');
  27.     }
  28. }