<?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 Version20241231143524 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
// dtb_category_artist
$this->addSql("CREATE TABLE `dtb_category_artist` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`parent_category_id` int unsigned DEFAULT NULL,
`creator_id` int unsigned DEFAULT NULL,
`category_name` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`category_kana` varchar(255) COLLATE utf8mb4_bin NULL,
`category_likename` varchar(255) COLLATE utf8mb4_bin NULL,
`category_content` varchar(1000) COLLATE utf8mb4_bin NULL,
`template_id` int NULL DEFAULT '1',
`category_label` smallint unsigned DEFAULT NULL,
`hierarchy` int unsigned NOT NULL,
`sort_no` int NOT NULL,
`period_date` date DEFAULT NULL,
`create_date` datetime NOT NULL COMMENT '(DC2Type:datetimetz)',
`update_date` datetime NOT NULL COMMENT '(DC2Type:datetimetz)',
`discriminator_type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
PRIMARY KEY (`id`),
KEY `IDX_5ED2C2B796A8F93` (`parent_category_id`),
KEY `IDX_5ED2C2B61220EA7` (`creator_id`),
CONSTRAINT `FK_5ED2C2B61220EA7` FOREIGN KEY (`creator_id`) REFERENCES `dtb_member` (`id`),
CONSTRAINT `FK_5ED2C2B796A8F93` FOREIGN KEY (`parent_category_id`) REFERENCES `dtb_category_artist` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
// dtb_category_tv
$this->addSql("CREATE TABLE `dtb_category_tv` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`parent_category_id` int unsigned DEFAULT NULL,
`creator_id` int unsigned DEFAULT NULL,
`category_name` varchar(255) COLLATE utf8mb4_bin NOT NULL,
`no` varchar(4) NULL,
`contents` text NULL,
`reserve_flg` tinyint DEFAULT '0',
`hierarchy` int unsigned NOT NULL,
`sort_no` int NOT NULL,
`period_date` date DEFAULT NULL,
`create_date` datetime NOT NULL COMMENT '(DC2Type:datetimetz)',
`update_date` datetime NOT NULL COMMENT '(DC2Type:datetimetz)',
`discriminator_type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
PRIMARY KEY (`id`),
KEY `IDX_5ED2C2B796A8F94` (`parent_category_id`),
KEY `IDX_5ED2C2B61220EA8` (`creator_id`),
CONSTRAINT `FK_5ED2C2B61220EA8` FOREIGN KEY (`creator_id`) REFERENCES `dtb_member` (`id`),
CONSTRAINT `FK_5ED2C2B796A8F94` FOREIGN KEY (`parent_category_id`) REFERENCES `dtb_category_tv` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
// dtb_product_category_artist
$this->addSql("CREATE TABLE `dtb_product_category_artist` (
`product_id` int unsigned NOT NULL,
`category_id` int unsigned NOT NULL,
`discriminator_type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
PRIMARY KEY (`product_id`,`category_id`),
KEY `IDX_B05778914584666B` (`product_id`),
KEY `IDX_B057789112469DF3` (`category_id`),
CONSTRAINT `FK_B057789112469DF3` FOREIGN KEY (`category_id`) REFERENCES `dtb_category_artist` (`id`),
CONSTRAINT `FK_B05778914584666B` FOREIGN KEY (`product_id`) REFERENCES `dtb_product` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
// dtb_product_category_artist
$this->addSql("CREATE TABLE `dtb_product_category_artist_rel` (
`product_id` int unsigned NOT NULL,
`category_id` int unsigned NOT NULL,
`discriminator_type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
PRIMARY KEY (`product_id`,`category_id`),
KEY `IDX_B05778914584666C` (`product_id`),
KEY `IDX_B057789112469DF6` (`category_id`),
CONSTRAINT `FK_B057789112469DF6` FOREIGN KEY (`category_id`) REFERENCES `dtb_category_artist` (`id`),
CONSTRAINT `FK_B05778914584666C` FOREIGN KEY (`product_id`) REFERENCES `dtb_product` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
// dtb_product_category_tv
$this->addSql("CREATE TABLE `dtb_product_category_tv` (
`product_id` int unsigned NOT NULL,
`category_id` int unsigned NOT NULL,
`discriminator_type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
PRIMARY KEY (`product_id`,`category_id`),
KEY `IDX_B05778914584666C` (`product_id`),
KEY `IDX_B057789112469DF4` (`category_id`),
CONSTRAINT `FK_B057789112469DF4` FOREIGN KEY (`category_id`) REFERENCES `dtb_category_tv` (`id`),
CONSTRAINT `FK_B05778914584666C` FOREIGN KEY (`product_id`) REFERENCES `dtb_product` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql("DROP TABLE dtb_category_artist;");
$this->addSql("DROP TABLE dtb_category_tv;");
$this->addSql("DROP TABLE dtb_product_category_artist;");
$this->addSql("DROP TABLE dtb_product_category_tv;");
}
}