<?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 Version20221118104143 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 team (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)\', name VARCHAR(128) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, is_active TINYINT(1) DEFAULT 1 NOT NULL, INDEX IDX_C4E0A61FB03A8386 (created_by_id), INDEX IDX_C4E0A61F896DBBDE (updated_by_id), INDEX IDX_C4E0A61FC76F1F52 (deleted_by_id), INDEX name (name), INDEX is_active (is_active), 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 team_translations (id INT AUTO_INCREMENT NOT NULL, object_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', locale VARCHAR(8) NOT NULL, field VARCHAR(32) NOT NULL, content LONGTEXT DEFAULT NULL, INDEX IDX_CE31D745232D562B (object_id), FULLTEXT INDEX content (content), UNIQUE INDEX lookup_unique_idx (locale, object_id, field), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE team_user (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', team_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', user_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)\', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_5C722232296CD8AE (team_id), INDEX IDX_5C722232A76ED395 (user_id), INDEX IDX_5C722232B03A8386 (created_by_id), INDEX IDX_5C722232896DBBDE (updated_by_id), INDEX IDX_5C722232C76F1F52 (deleted_by_id), 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('ALTER TABLE team ADD CONSTRAINT FK_C4E0A61FB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE team ADD CONSTRAINT FK_C4E0A61F896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE team ADD CONSTRAINT FK_C4E0A61FC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE team_translations ADD CONSTRAINT FK_CE31D745232D562B FOREIGN KEY (object_id) REFERENCES team (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE team_user ADD CONSTRAINT FK_5C722232296CD8AE FOREIGN KEY (team_id) REFERENCES team (id)');
$this->addSql('ALTER TABLE team_user ADD CONSTRAINT FK_5C722232A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE team_user ADD CONSTRAINT FK_5C722232B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE team_user ADD CONSTRAINT FK_5C722232896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE team_user ADD CONSTRAINT FK_5C722232C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE team_translations DROP FOREIGN KEY FK_CE31D745232D562B');
$this->addSql('ALTER TABLE team_user DROP FOREIGN KEY FK_5C722232296CD8AE');
$this->addSql('DROP TABLE team');
$this->addSql('DROP TABLE team_translations');
$this->addSql('DROP TABLE team_user');
}
}