12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- /*
- * @Descripttion:
- * @version: 1.0.0
- * @Author: likang
- * @Date: 2022-07-06 11:44:53
- * @LastEditors: likang
- * @LastEditTime: 2022-07-11 11:18:04
- */
- use think\migration\Migrator;
- use think\migration\db\Column;
- use Phinx\Db\Adapter\MysqlAdapter;
- class Publish extends Migrator
- {
- /**
- * Change Method.
- *
- * Write your reversible migrations using this method.
- *
- * More information on writing migrations is available here:
- * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
- *
- * The following commands can be used in this method and Phinx will
- * automatically reverse them when rolling back:
- *
- * createTable
- * renameTable
- * addColumn
- * renameColumn
- * addIndex
- * addForeignKey
- *
- * Remember to call "create()" or "update()" and NOT "save()" when working
- * with the Table class.
- */
- public function change()
- {
- $table = $this->table('publish', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '下发表', 'id' => 'id', 'signed' => true, 'primary_key' => ['id']]);
- $table->addColumn('Type', 'string', ['limit' => 50, 'null' => true, 'signed' => true, 'comment' => '类型 add|update|delete',])
- ->addColumn('ContentType', 'string', ['limit' => 50, 'null' => true, 'signed' => true, 'comment' => '数据类型',])
- ->addColumn('Content', 'text', ['limit' => MysqlAdapter::TEXT_LONG, 'null' => true, 'signed' => true, 'comment' => '内容 json',])
- ->addColumn('Imei', 'string', ['limit' => 255, 'null' => true, 'signed' => true, 'comment' => '网关imei',])
- ->addColumn('ContentId', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => true, 'signed' => true, 'comment' => '内容id',])
- ->addColumn('AddTime', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'null' => true, 'signed' => true, 'comment' => '添加时间',])
- ->addColumn('Version', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'null' => true, 'signed' => true, 'comment' => '毫秒时间戳',])
- ->addColumn('Status', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => true, 'signed' => true, 'comment' => '1 更新 2 只读',])
- ->create();
- }
- }
|