| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- *
- * Class M221123070250CreateUserThirdPartyAddressTable
- */
- class M221123070250CreateUserThirdPartyAddressTable extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $table = 'qimall_user_third_party_address';
- $check_table_sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($check_table_sql)->execute();
- if (!empty($res)) return '';
- $this->createTable($table, [
- 'id' => $this->primaryKey(),
- 'user_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('User ID'),
- 'mall_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('Mall ID'),
- 'status' => $this->tinyInteger(1)->notNull()->defaultValue(1)->comment('状态,-1:已删除;0:禁用;1:正常'),
- 'third_party_address' => $this->text()->comment('Third Party Address'),
- 'created_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('Created At'),
- 'updated_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('Updated At'),
- ]);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- // $this->dropTable('{{%user_third_party_address}}');
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M221123070250CreateUserThirdPartyAddressTable cannot be reverted.\n";
- return false;
- }
- */
- }
|