| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M230218073410CreateQimallCommissionLogRelation
- */
- class M230218073410CreateQimallCommissionLogRelation extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_commission_log_relation';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $sql="CREATE TABLE `qimall_commission_log_relation` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `log_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'commisssion的id/commisssion的id_frozen的id',
- `source_type` varchar(255) NOT NULL DEFAULT '' COMMENT 'commisssion/commisssion_frozen',
- `describe` varchar(1000) NOT NULL DEFAULT '' COMMENT '自定义的描述',
- `created_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间戳',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `idx_source_type_log_id` (`source_type`,`log_id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='佣金记录关联表表';";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230218073410CreateQimallCommissionLogRelation cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230218073410CreateQimallCommissionLogRelation cannot be reverted.\n";
- return false;
- }
- */
- }
|