| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- use think\migration\Migrator;
- class ExtensionEvaAttribute 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(): void
- {
- $this->table('extension_eva_attribute', ['engine' => 'InnoDB', 'charset' => 'utf8mb4', 'comment' => '属性定义表'])
- ->addColumn('entity_type_id', 'integer', ['comment' => '关联实体类型'])
- ->addColumn('attribute_code', 'string', ['comment' => '属性编码', 'limit' => 64])
- ->addColumn('backend_type', 'string', ['comment' => '存储类型(int/varchar/decimal/text), 需与frontend_input匹配', 'limit' => 8])
- ->addColumn('frontend_input', 'string', ['comment' => '表单控件类型', 'limit' => 16])
- ->addColumn('frontend_label', 'string', ['comment' => '显示标签', 'limit' => 255])
- ->addColumn('is_required', 'boolean', ['comment' => '是否必填', 'default' => false])
- ->addIndex(['entity_type_id', 'attribute_code'], ['unique' => true])
- ->addTimestamps()
- ->addSoftDelete()
- ->create();
- }
- }
|