| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M230630071801QimallReference
- */
- class M230630071801QimallReference extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_reference';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $sql="
- CREATE TABLE `qimall_reference` (
- `id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'ID',
- `name` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '推荐人名称',
- `mobile` VARCHAR(20) NOT NULL DEFAULT '' COMMENT '推荐人手机号码',
- `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用;]',
- `created_at` bigint(20) NOT NULL DEFAULT '0' COMMENT '创建时间',
- `updated_at` bigint(20) NOT NULL DEFAULT '0' COMMENT '上次更新数据时间',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='推荐人';
- ";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230630071801QimallReference cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230630071801QimallReference cannot be reverted.\n";
- return false;
- }
- */
- }
|