20220706114453_publish.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /*
  3. * @Descripttion:
  4. * @version: 1.0.0
  5. * @Author: likang
  6. * @Date: 2022-07-06 11:44:53
  7. * @LastEditors: likang
  8. * @LastEditTime: 2022-07-11 11:18:04
  9. */
  10. use think\migration\Migrator;
  11. use think\migration\db\Column;
  12. use Phinx\Db\Adapter\MysqlAdapter;
  13. class Publish extends Migrator
  14. {
  15. /**
  16. * Change Method.
  17. *
  18. * Write your reversible migrations using this method.
  19. *
  20. * More information on writing migrations is available here:
  21. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  22. *
  23. * The following commands can be used in this method and Phinx will
  24. * automatically reverse them when rolling back:
  25. *
  26. * createTable
  27. * renameTable
  28. * addColumn
  29. * renameColumn
  30. * addIndex
  31. * addForeignKey
  32. *
  33. * Remember to call "create()" or "update()" and NOT "save()" when working
  34. * with the Table class.
  35. */
  36. public function change()
  37. {
  38. $table = $this->table('publish', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '下发表', 'id' => 'id', 'signed' => true, 'primary_key' => ['id']]);
  39. $table->addColumn('Type', 'string', ['limit' => 50, 'null' => true, 'signed' => true, 'comment' => '类型 add|update|delete',])
  40. ->addColumn('ContentType', 'string', ['limit' => 50, 'null' => true, 'signed' => true, 'comment' => '数据类型',])
  41. ->addColumn('Content', 'text', ['limit' => MysqlAdapter::TEXT_LONG, 'null' => true, 'signed' => true, 'comment' => '内容 json',])
  42. ->addColumn('Imei', 'string', ['limit' => 255, 'null' => true, 'signed' => true, 'comment' => '网关imei',])
  43. ->addColumn('ContentId', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => true, 'signed' => true, 'comment' => '内容id',])
  44. ->addColumn('AddTime', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'null' => true, 'signed' => true, 'comment' => '添加时间',])
  45. ->addColumn('Version', 'integer', ['limit' => MysqlAdapter::INT_BIG, 'null' => true, 'signed' => true, 'comment' => '毫秒时间戳',])
  46. ->addColumn('Status', 'integer', ['limit' => MysqlAdapter::INT_REGULAR, 'null' => true, 'signed' => true, 'comment' => '1 更新 2 只读',])
  47. ->create();
  48. }
  49. }