migrations/Version20230530124751.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. final class Version20230530124751 extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return 'Announcements table';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql("
  15.             CREATE TABLE `announcement`  (
  16.               `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
  17.               `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
  18.               `user_id` bigint UNSIGNED NULL DEFAULT NULL,
  19.               `status` smallint UNSIGNED NOT NULL DEFAULT 0,
  20.               `type` smallint UNSIGNED NOT NULL,
  21.               `additional_data` json NULL,
  22.               `min_views_per_video` int UNSIGNED NULL DEFAULT NULL,
  23.               `max_views_per_video` int UNSIGNED NULL DEFAULT NULL,
  24.               `min_follower_count` int UNSIGNED NULL DEFAULT NULL,
  25.               `max_follower_count` int UNSIGNED NULL DEFAULT NULL,
  26.               `min_video_count` int UNSIGNED NULL DEFAULT NULL,
  27.               `max_video_count` int UNSIGNED NULL DEFAULT NULL,
  28.               `min_like_count` int UNSIGNED NULL DEFAULT NULL,
  29.               `max_like_count` int UNSIGNED NULL DEFAULT NULL,
  30.               `gender` smallint UNSIGNED NOT NULL DEFAULT 3,
  31.               `vip_creator` tinyint(1) NULL DEFAULT NULL,
  32.               `verified_creator` tinyint(1) NULL DEFAULT NULL,
  33.               `unverified_creator` tinyint(1) NULL DEFAULT NULL,
  34.               `creator_geolocation_enabled` tinyint(1) NULL DEFAULT NULL,
  35.               `creator_geolocation_disabled` tinyint(1) NULL DEFAULT NULL,
  36.               `created_at` datetime NOT NULL,
  37.               `updated_at` datetime NULL DEFAULT NULL,
  38.               `end_date` date NULL DEFAULT NULL,
  39.               PRIMARY KEY (`id`) USING BTREE,
  40.               INDEX `user_id`(`user_id`) USING BTREE,
  41.               CONSTRAINT `announcement_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
  42.             ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic
  43.         ");
  44.     }
  45.     public function down(Schema $schema): void
  46.     {
  47.         $this->addSql("DROP TABLE IF EXISTS `announcement`");
  48.     }
  49. }