<?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 Version20260109000000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add dtb_set_product_tag table for set product tagging feature';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
if (!$schema->hasTable('dtb_set_product_tag')) {
$table = $schema->createTable('dtb_set_product_tag');
$table->addColumn('id', 'integer', ['autoincrement' => true, 'unsigned' => true]);
$table->addColumn('set_product_id', 'integer', ['unsigned' => true]);
$table->addColumn('tag_id', 'integer', ['notnull' => false, 'unsigned' => true]);
$table->addColumn('creator_id', 'integer', ['notnull' => false, 'unsigned' => true]);
$table->addColumn('create_date', 'datetimetz');
$table->addColumn('discriminator_type', 'string', ['length' => 255, 'notnull' => false]);
$table->setPrimaryKey(['id']);
$table->addIndex(['set_product_id'], 'idx_set_product_tag_set_product_id');
$table->addIndex(['tag_id'], 'idx_set_product_tag_tag_id');
$table->addForeignKeyConstraint('dtb_set_product', ['set_product_id'], ['set_product_id']);
$table->addForeignKeyConstraint('dtb_tag', ['tag_id'], ['id']);
$table->addForeignKeyConstraint('dtb_member', ['creator_id'], ['id']);
}
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
if ($schema->hasTable('dtb_set_product_tag')) {
$schema->dropTable('dtb_set_product_tag');
}
}
}