app/DoctrineMigrations/Version20241231143524.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20241231143524 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         // dtb_category_artist
  19.         $this->addSql("CREATE TABLE `dtb_category_artist` (
  20.             `id` int unsigned NOT NULL AUTO_INCREMENT,
  21.             `parent_category_id` int unsigned DEFAULT NULL,
  22.             `creator_id` int unsigned DEFAULT NULL,
  23.             `category_name` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  24.             `category_kana` varchar(255) COLLATE utf8mb4_bin NULL,
  25.             `category_likename` varchar(255) COLLATE utf8mb4_bin NULL,
  26.             `category_content` varchar(1000) COLLATE utf8mb4_bin NULL,
  27.             `template_id` int NULL DEFAULT '1',
  28.             `category_label` smallint unsigned DEFAULT NULL,
  29.             `hierarchy` int unsigned NOT NULL,
  30.             `sort_no` int NOT NULL,
  31.             `period_date` date DEFAULT NULL,
  32.             `create_date` datetime NOT NULL COMMENT '(DC2Type:datetimetz)',
  33.             `update_date` datetime NOT NULL COMMENT '(DC2Type:datetimetz)',
  34.             `discriminator_type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  35.             PRIMARY KEY (`id`),
  36.             KEY `IDX_5ED2C2B796A8F93` (`parent_category_id`),
  37.             KEY `IDX_5ED2C2B61220EA7` (`creator_id`),
  38.             CONSTRAINT `FK_5ED2C2B61220EA7` FOREIGN KEY (`creator_id`) REFERENCES `dtb_member` (`id`),
  39.             CONSTRAINT `FK_5ED2C2B796A8F93` FOREIGN KEY (`parent_category_id`) REFERENCES `dtb_category_artist` (`id`)
  40.             ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
  41.         // dtb_category_tv
  42.         $this->addSql("CREATE TABLE `dtb_category_tv` (
  43.             `id` int unsigned NOT NULL AUTO_INCREMENT,
  44.             `parent_category_id` int unsigned DEFAULT NULL,
  45.             `creator_id` int unsigned DEFAULT NULL,
  46.             `category_name` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  47.             
  48.             `no` varchar(4) NULL,
  49.             `contents` text NULL,
  50.             `reserve_flg` tinyint DEFAULT '0',
  51.             `hierarchy` int unsigned NOT NULL,
  52.             `sort_no` int NOT NULL,
  53.             `period_date` date DEFAULT NULL,
  54.             `create_date` datetime NOT NULL COMMENT '(DC2Type:datetimetz)',
  55.             `update_date` datetime NOT NULL COMMENT '(DC2Type:datetimetz)',
  56.             `discriminator_type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  57.             PRIMARY KEY (`id`),
  58.             KEY `IDX_5ED2C2B796A8F94` (`parent_category_id`),
  59.             KEY `IDX_5ED2C2B61220EA8` (`creator_id`),
  60.             CONSTRAINT `FK_5ED2C2B61220EA8` FOREIGN KEY (`creator_id`) REFERENCES `dtb_member` (`id`),
  61.             CONSTRAINT `FK_5ED2C2B796A8F94` FOREIGN KEY (`parent_category_id`) REFERENCES `dtb_category_tv` (`id`)
  62.         ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
  63.         // dtb_product_category_artist
  64.         $this->addSql("CREATE TABLE `dtb_product_category_artist` (
  65.             `product_id` int unsigned NOT NULL,
  66.             `category_id` int unsigned NOT NULL,
  67.             `discriminator_type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  68.             PRIMARY KEY (`product_id`,`category_id`),
  69.             KEY `IDX_B05778914584666B` (`product_id`),
  70.             KEY `IDX_B057789112469DF3` (`category_id`),
  71.             CONSTRAINT `FK_B057789112469DF3` FOREIGN KEY (`category_id`) REFERENCES `dtb_category_artist` (`id`),
  72.             CONSTRAINT `FK_B05778914584666B` FOREIGN KEY (`product_id`) REFERENCES `dtb_product` (`id`)
  73.             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
  74.         
  75.         // dtb_product_category_artist
  76.         $this->addSql("CREATE TABLE `dtb_product_category_artist_rel` (
  77.             `product_id` int unsigned NOT NULL,
  78.             `category_id` int unsigned NOT NULL,
  79.             `discriminator_type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  80.             PRIMARY KEY (`product_id`,`category_id`),
  81.             KEY `IDX_B05778914584666C` (`product_id`),
  82.             KEY `IDX_B057789112469DF6` (`category_id`),
  83.             CONSTRAINT `FK_B057789112469DF6` FOREIGN KEY (`category_id`) REFERENCES `dtb_category_artist` (`id`),
  84.             CONSTRAINT `FK_B05778914584666C` FOREIGN KEY (`product_id`) REFERENCES `dtb_product` (`id`)
  85.             ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
  86.         // dtb_product_category_tv
  87.         $this->addSql("CREATE TABLE `dtb_product_category_tv` (
  88.             `product_id` int unsigned NOT NULL,
  89.             `category_id` int unsigned NOT NULL,
  90.             `discriminator_type` varchar(255) COLLATE utf8mb4_bin NOT NULL,
  91.             PRIMARY KEY (`product_id`,`category_id`),
  92.             KEY `IDX_B05778914584666C` (`product_id`),
  93.             KEY `IDX_B057789112469DF4` (`category_id`),
  94.             CONSTRAINT `FK_B057789112469DF4` FOREIGN KEY (`category_id`) REFERENCES `dtb_category_tv` (`id`),
  95.             CONSTRAINT `FK_B05778914584666C` FOREIGN KEY (`product_id`) REFERENCES `dtb_product` (`id`)
  96.           ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
  97.     }
  98.     public function down(Schema $schema): void
  99.     {
  100.         // this down() migration is auto-generated, please modify it to your needs
  101.         $this->addSql("DROP TABLE dtb_category_artist;");
  102.         $this->addSql("DROP TABLE dtb_category_tv;");
  103.         $this->addSql("DROP TABLE dtb_product_category_artist;");
  104.         $this->addSql("DROP TABLE dtb_product_category_tv;");
  105.     }
  106. }