20250712021931_extension_eav_attribute.php 1.3 KB

12345678910111213141516171819202122232425262728
  1. <?php
  2. declare(strict_types=1);
  3. use Phinx\Migration\AbstractMigration;
  4. class ExtensionEavAttribute extends AbstractMigration
  5. {
  6. /**
  7. * Change Method.
  8. *
  9. * Write your reversible migrations using this method.
  10. */
  11. public function change(): void
  12. {
  13. $this->table('extension_eav_attribute', ['engine' => 'InnoDB', 'charset' => 'utf8mb4', 'comment' => '属性定义表'])
  14. ->addColumn('entity_type_id', 'integer', ['signed' => false, 'comment' => '关联实体类型'])
  15. ->addColumn('attribute_code', 'string', ['comment' => '属性编码', 'limit' => 64])
  16. ->addColumn('backend_type', 'string', ['comment' => '存储类型(int/varchar/decimal/text), 需与frontend_input匹配', 'limit' => 8])
  17. ->addColumn('frontend_input', 'string', ['comment' => '表单控件类型', 'limit' => 16])
  18. ->addColumn('frontend_label', 'string', ['comment' => '显示标签', 'limit' => 255])
  19. ->addColumn('is_required', 'boolean', ['comment' => '是否必填', 'default' => false])
  20. ->addIndex(['entity_type_id', 'attribute_code'], ['unique' => true])
  21. ->addTimestamps('create_time', 'update_time')
  22. ->addColumn('delete_time', 'timestamp', ['null' => true, 'comment' => '删除时间'])
  23. ->create();
  24. }
  25. }