123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- use yii\db\Migration;
- /**
- * Class m230214_035736_comments_conf
- */
- class m230214_035736_comments_conf extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql = "CREATE TABLE `comments_conf` (
- `AllStop` enum('N','Y') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N',
- `reg` enum('N','Y') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N',
- `dt_start` time NOT NULL DEFAULT '00:00:00',
- `dt_stop` time NOT NULL DEFAULT '23:59:59',
- `d0` enum('N','Y') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N',
- `d1` enum('N','Y') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N',
- `d2` enum('N','Y') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N',
- `d3` enum('N','Y') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N',
- `d4` enum('N','Y') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N',
- `d5` enum('N','Y') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N',
- `d6` enum('N','Y') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'N'
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Настройка коментариев';
- COMMIT;";
- $this->execute($sql);
- $sql = "INSERT INTO `comments_conf` (`AllStop`, `reg`, `dt_start`, `dt_stop`, `d0`, `d1`, `d2`, `d3`, `d4`, `d5`, `d6`) VALUES ('N', 'N', '00:00:00.000000', '23:59:59.000000', 'N', 'N', 'N', 'N', 'N', 'Y', 'Y');";
- $this->execute($sql);
- $sql = "ALTER TABLE `comments_conf` ADD `id` TINYINT NOT NULL DEFAULT '0' FIRST, ADD PRIMARY KEY (`id`);";
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "m230214_035736_comments_conf cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "m230214_035736_comments_conf cannot be reverted.\n";
- return false;
- }
- */
- }
|