|
@@ -0,0 +1,62 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+use think\migration\Migrator;
|
|
|
+use think\migration\db\Column;
|
|
|
+use Phinx\Db\Adapter\MysqlAdapter;
|
|
|
+
|
|
|
+class Hydraulic 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('hydraulic', ['engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci', 'comment' => '' ,'id' => 'id','signed' => true ,'primary_key' => ['id']]);
|
|
|
+ //基础信息
|
|
|
+ $table->addColumn('number', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '编号',])
|
|
|
+ ->addColumn('model', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '型号',])
|
|
|
+ ->addColumn('department_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '所属部门',])
|
|
|
+ ->addColumn('name', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '名称',])
|
|
|
+ ->addColumn('is_used', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '使用状态',])
|
|
|
+ ->addColumn('brand', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '品牌',])
|
|
|
+ ->addColumn('supplier', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '供应商',])
|
|
|
+ ->addColumn('out_date', 'date', ['null' => true,'signed' => true,'comment' => '出厂日期',])
|
|
|
+ ->addColumn('remark', 'string', ['limit' => 255,'null' => true,'signed' => true,'comment' => '备注',])
|
|
|
+ ->addColumn('type', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '设备类型',])
|
|
|
+ ->addColumn('alarm_state', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '告警状态',])
|
|
|
+ ->addColumn('net_state', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => true,'comment' => '网络状态',])
|
|
|
+ ->addColumn('online_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'default' => null,'signed' => true,'comment' => '在线时间',])
|
|
|
+ ->addColumn('creator_id', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建人ID',])
|
|
|
+ ->addColumn('created_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '创建时间',])
|
|
|
+ ->addColumn('updated_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '更新时间',])
|
|
|
+ ->addColumn('deleted_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '软删除',])
|
|
|
+
|
|
|
+ //液压泵规格信息
|
|
|
+ ->addColumn('pressure_range', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '压力范围(PSI)',])
|
|
|
+ //液压扳手实时维保信息
|
|
|
+ ->addColumn('coefficient_a', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '校准系数a',])
|
|
|
+ ->addColumn('coefficient_b', 'string', ['limit' => 50,'null' => true,'signed' => true,'comment' => '校准系数b',])
|
|
|
+ ->addColumn('checked_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '校验时间',])
|
|
|
+ ->addColumn('checked_no', 'string', ['limit' => 50,'null' => true,'default' => null,'signed' => false,'comment' => '校验台编号',])
|
|
|
+ ->addColumn('checked_res', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => false,'default' => 0,'signed' => false,'comment' => '校验结果',])
|
|
|
+ ->create();
|
|
|
+ }
|
|
|
+}
|