| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace addons\Course\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230629091038QimallAddonsCoursePromoter
- */
- class M230629091038QimallAddonsCoursePromoter extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_addons_course_promoter';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $sql = "
- CREATE TABLE `qimall_addons_course_promoter` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) unsigned NOT NULL DEFAULT '0',
- `user_id` int(11) unsigned NOT NULL DEFAULT '0',
- `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '活动状态,1:启用,0:禁用,-1删除',
- `created_at` int(10) unsigned NOT NULL DEFAULT '0',
- `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='推广员表';
- ";
- $this->execute($sql);
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230629091038QimallAddonsCoursePromoter cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230629091038QimallAddonsCoursePromoter cannot be reverted.\n";
- return false;
- }
- */
- }
|