<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20230530124751 extends AbstractMigration
{
public function getDescription(): string
{
return 'Announcements table';
}
public function up(Schema $schema): void
{
$this->addSql("
CREATE TABLE `announcement` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`user_id` bigint UNSIGNED NULL DEFAULT NULL,
`status` smallint UNSIGNED NOT NULL DEFAULT 0,
`type` smallint UNSIGNED NOT NULL,
`additional_data` json NULL,
`min_views_per_video` int UNSIGNED NULL DEFAULT NULL,
`max_views_per_video` int UNSIGNED NULL DEFAULT NULL,
`min_follower_count` int UNSIGNED NULL DEFAULT NULL,
`max_follower_count` int UNSIGNED NULL DEFAULT NULL,
`min_video_count` int UNSIGNED NULL DEFAULT NULL,
`max_video_count` int UNSIGNED NULL DEFAULT NULL,
`min_like_count` int UNSIGNED NULL DEFAULT NULL,
`max_like_count` int UNSIGNED NULL DEFAULT NULL,
`gender` smallint UNSIGNED NOT NULL DEFAULT 3,
`vip_creator` tinyint(1) NULL DEFAULT NULL,
`verified_creator` tinyint(1) NULL DEFAULT NULL,
`unverified_creator` tinyint(1) NULL DEFAULT NULL,
`creator_geolocation_enabled` tinyint(1) NULL DEFAULT NULL,
`creator_geolocation_disabled` tinyint(1) NULL DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NULL DEFAULT NULL,
`end_date` date NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `user_id`(`user_id`) USING BTREE,
CONSTRAINT `announcement_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic
");
}
public function down(Schema $schema): void
{
$this->addSql("DROP TABLE IF EXISTS `announcement`");
}
}