| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M250225035230OrderReserveAddColumn
- */
- class M250225035230OrderReserveAddColumn extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $cursor = \Yii::$app->db->schema->getTableSchema('qimall_order_reserve', true);
- if ($cursor) {
- if (!$cursor->getColumn('service_start_at')) {
- $this->execute("alter table qimall_order_reserve add service_start_at int(11) not null default 0 comment'服务开始时间'");
- }
- if (!$cursor->getColumn('service_end_at')) {
- $this->execute("alter table qimall_order_reserve add service_end_at int(11) not null default 0 comment'服务结束时间'");
- }
- if (!$cursor->getColumn('goods_id')) {
- $this->execute("alter table qimall_order_reserve add goods_id int(11) not null default 0 comment'商品id'");
- }
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M250225035230OrderReserveAddColumn cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M250225035230OrderReserveAddColumn cannot be reverted.\n";
- return false;
- }
- */
- }
|