| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M230531060455QimallSyncGoodsLogs
- */
- class M230531060455QimallSyncGoodsLogs extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_sync_goods_logs';
- $sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if (!empty($res)) return '';
- $sql = "
- CREATE TABLE `qimall_sync_goods_logs` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT,
- `self_mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '自身商城ID',
- `source_mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '源商城ID',
- `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '自身商城的商品id',
- `source_goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '源商城的商品id',
- `created_at` bigint(20) NOT NULL DEFAULT '0',
- `updated_at` bigint(20) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商城商品同步日志表';";
- $this->execute($sql);
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230531060455QimallSyncGoodsLogs cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230531060455QimallSyncGoodsLogs cannot be reverted.\n";
- return false;
- }
- */
- }
|