<?php
declare(strict_types=1);
namespace CoreMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230302085125 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->addSql('CREATE TABLE activity (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', entity_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', entity_name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_AC74095AB03A8386 (created_by_id), INDEX IDX_AC74095A896DBBDE (updated_by_id), INDEX IDX_AC74095AC76F1F52 (deleted_by_id), INDEX entity_id (entity_id), INDEX entity_name (entity_name), INDEX deleted_at (deleted_at), INDEX created_at (created_at), INDEX updated_at (updated_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE activity_like (activity_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', user_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', INDEX IDX_AFA79B2181C06096 (activity_id), INDEX IDX_AFA79B21A76ED395 (user_id), PRIMARY KEY(activity_id, user_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE bundle (id INT AUTO_INCREMENT NOT NULL, created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) NOT NULL, namespace VARCHAR(255) NOT NULL, version VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_A57B32FDB03A8386 (created_by_id), INDEX IDX_A57B32FD896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE mail_message (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', entity_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', entity_name VARCHAR(255) DEFAULT NULL, recipient VARCHAR(255) DEFAULT NULL, cc VARCHAR(255) DEFAULT NULL, bcc VARCHAR(255) DEFAULT NULL, subject VARCHAR(255) DEFAULT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_6C00B110B03A8386 (created_by_id), INDEX IDX_6C00B110896DBBDE (updated_by_id), INDEX entity_id (entity_id), INDEX entity_name (entity_name), INDEX recipient (recipient), INDEX cc (cc), INDEX bcc (bcc), INDEX subject (subject), INDEX created_at (created_at), INDEX updated_at (updated_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE activity ADD CONSTRAINT FK_AC74095AB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE activity ADD CONSTRAINT FK_AC74095A896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE activity ADD CONSTRAINT FK_AC74095AC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE activity_like ADD CONSTRAINT FK_AFA79B2181C06096 FOREIGN KEY (activity_id) REFERENCES activity (id)');
$this->addSql('ALTER TABLE activity_like ADD CONSTRAINT FK_AFA79B21A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE bundle ADD CONSTRAINT FK_A57B32FDB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE bundle ADD CONSTRAINT FK_A57B32FD896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE mail_message ADD CONSTRAINT FK_6C00B110B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE mail_message ADD CONSTRAINT FK_6C00B110896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE tax ADD product_sales_account_number VARCHAR(32) DEFAULT NULL, ADD service_sales_account_number VARCHAR(32) DEFAULT NULL');
$this->addSql('CREATE INDEX product_sales_account_number ON tax (product_sales_account_number)');
$this->addSql('CREATE INDEX service_sales_account_number ON tax (service_sales_account_number)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE activity_like DROP FOREIGN KEY FK_AFA79B2181C06096');
$this->addSql('DROP TABLE activity');
$this->addSql('DROP TABLE activity_like');
$this->addSql('DROP TABLE bundle');
$this->addSql('DROP TABLE mail_message');
$this->addSql('DROP INDEX product_sales_account_number ON tax');
$this->addSql('DROP INDEX service_sales_account_number ON tax');
$this->addSql('ALTER TABLE tax DROP product_sales_account_number, DROP service_sales_account_number');
}
}