| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M240824024304QimallUserDelLog
- */
- class M240824024304QimallUserDelLog extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $table = 'qimall_user_del_log';
- $sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if (!empty($res)) return '';
- $sql = "
- CREATE TABLE `qimall_user_del_log` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL,
- `user_id` int(11) NOT NULL,
- `new_mobile` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
- `old_mobile` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
- `status` int(11) NOT NULL DEFAULT '1',
- `created_at` bigint(20) DEFAULT '0' COMMENT '添加时间戳',
- `updated_at` bigint(20) DEFAULT '0' COMMENT '更新时间戳',
- PRIMARY KEY (`id`),
- KEY `index_mall_id` (`mall_id`),
- KEY `index_user_id` (`user_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户删除记录';
- ";
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240824024304QimallUserDelLog cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240824024304QimallUserDelLog cannot be reverted.\n";
- return false;
- }
- */
- }
|