| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M230621080751QimallVideoTutorialsLog
- */
- class M230621080751QimallVideoTutorialsLog extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_video_tutorials_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_video_tutorials_log` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `admin_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '账户id',
- `video_tutorials_id` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '视频教程id',
- `is_complete` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否完整观看;1:是;0否',
- `view_times` int(11) NOT NULL DEFAULT '0' COMMENT '浏览时长',
- `created_at` int(11) NOT NULL DEFAULT '0',
- `updated_at` int(11) NOT NULL DEFAULT '0',
- `status` tinyint(1) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='视频教程浏览记录';
- ";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230621080751QimallVideoTutorialsLog cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230621080751QimallVideoTutorialsLog cannot be reverted.\n";
- return false;
- }
- */
- }
|