M230717100209QimallAddonsCloudStockBonusPoolLogDetail.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace addons\CloudStock\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230717100209QimallAddonsCloudStockBonusPoolLogDetail
  6. */
  7. class M230717100209QimallAddonsCloudStockBonusPoolLogDetail extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $table = 'qimall_addons_cloud_stock_bonus_pool_log_detail';
  16. $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  17. $res = $this->db->createCommand($sql)->execute();
  18. if(!empty($res)) return '';
  19. $sql="CREATE TABLE `qimall_addons_cloud_stock_bonus_pool_log_detail` (
  20. `id` bigint(20) NOT NULL AUTO_INCREMENT,
  21. `mall_id` int(11) NOT NULL COMMENT '商城ID',
  22. `pool_log_id` int(11) NOT NULL COMMENT 'pool_log_id',
  23. `user_id` int(11) NOT NULL COMMENT 'user_id',
  24. `level` int(11) NOT NULL DEFAULT '0' COMMENT '分红时等级',
  25. `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '当前分红池金额',
  26. `is_settled` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否结算:0:否;1:是',
  27. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  28. `created_at` bigint(20) DEFAULT NULL,
  29. `updated_at` bigint(20) DEFAULT NULL,
  30. PRIMARY KEY (`id`) USING BTREE
  31. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='云库存分红池记录详情';";
  32. $this->execute($sql);
  33. }catch (\Exception $e){
  34. }
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function safeDown()
  40. {
  41. echo "M230717100209QimallAddonsCloudStockBonusPoolLogDetail cannot be reverted.\n";
  42. return false;
  43. }
  44. /*
  45. // Use up()/down() to run migration code without a transaction.
  46. public function up()
  47. {
  48. }
  49. public function down()
  50. {
  51. echo "M230717100209QimallAddonsCloudStockBonusPoolLogDetail cannot be reverted.\n";
  52. return false;
  53. }
  54. */
  55. }