20220427104913_wind.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. use Phinx\Db\Adapter\MysqlAdapter;
  5. class Wind extends Migrator
  6. {
  7. /**
  8. * Change Method.
  9. *
  10. * Write your reversible migrations using this method.
  11. *
  12. * More information on writing migrations is available here:
  13. * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
  14. *
  15. * The following commands can be used in this method and Phinx will
  16. * automatically reverse them when rolling back:
  17. *
  18. * createTable
  19. * renameTable
  20. * addColumn
  21. * renameColumn
  22. * addIndex
  23. * addForeignKey
  24. *
  25. * Remember to call "create()" or "update()" and NOT "save()" when working
  26. * with the Table class.
  27. */
  28. public function change()
  29. {
  30. $table = $this->table('wind', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
  31. $table->addColumn('name', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '风场名称',])
  32. ->addColumn('number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '编号',])
  33. ->addColumn('department_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '所属部门',])
  34. ->addColumn('address', 'string', ['limit' => 100,'null' => true,'signed' => true,'comment' => '风场地址',])
  35. ->addColumn('maintenance_count', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '维保设备数量',])
  36. ->addColumn('pump_count', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '泵设备数量',])
  37. ->addColumn('remark', 'string', ['limit' => 100,'null' => true,'signed' => true,'comment' => '备注',])
  38. ->addColumn('wind_shape', 'string', ['limit' => 20,'null' => false,'default' => '','signed' => true,'comment' => '风场形状',])
  39. ->addColumn('side_color', 'string', ['limit' => 20,'null' => false,'default' => '#03D0F9','signed' => true,'comment' => '风场边颜色',])
  40. ->addColumn('inside_color', 'string', ['limit' => 20,'null' => false,'default' => '#03D0F9','signed' => true,'comment' => '风场内颜色',])
  41. ->addColumn('wind_info', 'text', ['limit' => MysqlAdapter::TEXT_REGULAR,'null' => true,'signed' => true,'comment' => '风场区域信息',])
  42. ->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
  43. ->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
  44. ->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
  45. ->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '软删除',])
  46. ->create();
  47. }
  48. }