src/Migrations/Version20230302131234.php line 1
<?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 Version20230302131234 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 smi_item (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, link VARCHAR(255) DEFAULT NULL, publish_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', deleted TINYINT(1) DEFAULT 0 NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, weight INT DEFAULT 10 NOT NULL, active TINYINT(1) DEFAULT 1 NOT NULL, owner_uuid VARCHAR(36) DEFAULT NULL, owner_active TINYINT(1) DEFAULT 1 NOT NULL, owner_deleted TINYINT(1) DEFAULT 0 NOT NULL, INDEX IDX_67B98B5B03A8386 (created_by_id), INDEX IDX_67B98B5896DBBDE (updated_by_id), INDEX idx_active (deleted, active, weight DESC, publish_at DESC), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE smi_item_translation (id INT AUTO_INCREMENT NOT NULL, translatable_id INT DEFAULT NULL, caption VARCHAR(255) DEFAULT NULL, text LONGTEXT DEFAULT NULL, locale VARCHAR(5) NOT NULL, INDEX IDX_18FECE912C2AC5D3 (translatable_id), UNIQUE INDEX smi_item_translation_unique_translation (translatable_id, locale), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE smi_item ADD CONSTRAINT FK_67B98B5B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE smi_item ADD CONSTRAINT FK_67B98B5896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id) ON DELETE SET NULL');
$this->addSql('ALTER TABLE smi_item_translation ADD CONSTRAINT FK_18FECE912C2AC5D3 FOREIGN KEY (translatable_id) REFERENCES smi_item (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE smi_item DROP FOREIGN KEY FK_67B98B5B03A8386');
$this->addSql('ALTER TABLE smi_item DROP FOREIGN KEY FK_67B98B5896DBBDE');
$this->addSql('ALTER TABLE smi_item_translation DROP FOREIGN KEY FK_18FECE912C2AC5D3');
$this->addSql('DROP TABLE smi_item');
$this->addSql('DROP TABLE smi_item_translation');
}
}