| 1234567891011121314151617181920212223242526 |
- <?php
- use think\migration\Migrator;
- class ExtensionEavAttribute extends Migrator
- {
- /**
- * Change Method.
- *
- * Write your reversible migrations using this method.
- */
- public function change(): void
- {
- $this->table('extension_eav_attribute', ['engine' => 'InnoDB', 'charset' => 'utf8mb4', 'comment' => '属性定义表'])
- ->addColumn('entity_type_id', 'integer', ['signed' => false, '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();
- }
- }
|