| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- *
- * Class M220909073847CreateQimallGlobalVarMap
- */
- class M210909083847InsertQimallGlobalVarMap extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_global_var_map';
- $check_table_sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($check_table_sql)->execute();
- if(!empty($res)) return '';
- // 插入表数据
- $sql="INSERT INTO `qimall_global_var_map`( `name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ( 'extra_equal_1', '平一级奖励', 'CapitalTypeMap', 0, 1, 1661841988, 1661841988);";
- $this->execute($sql);
- $sql="INSERT INTO `qimall_global_var_map`( `name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ( 'extra_equal_2', '平二级奖励', 'CapitalTypeMap', 0, 1, 1661841988, 1661841988);";
- $this->execute($sql);
- $sql="INSERT INTO `qimall_global_var_map`( `name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ('drainage_subsidy', '引流补贴', 'CapitalTypeMap', 0, 1, 1661841988, 1661841988)";
- $this->execute($sql);
- $sql="INSERT INTO `qimall_global_var_map`( `name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ( 'team_subsidy', '团队补贴', 'CapitalTypeMap', 0, 1, 1661841988, 1661841988);";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M220909073847CreateQimallGlobalVarMap cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M220909073847CreateQimallGlobalVarMap cannot be reverted.\n";
- return false;
- }
- */
- }
|