creonit / propel-schema-converter-bundle
v0.2.5
2019-07-30 04:27 UTC
README
允许使用 YAML 描述模式
安装
###1. 使用 composer 安装包:composer require creonit/propel-schema-converter-bundle
###2. 在你的应用 AppKernel.php 中注册包
... public function registerBundles() { $bundles = array( ... new Creonit\PropelSchemaConverterBundle\CreonitPropelSchemaConverterBundle(), ... ); ...
用法
创建文件 BundleDir/Resources/config/schema.yml
并运行命令以构建模型或迁移。自动创建 schema.xml 文件。
示例 schema.yml
config: required: true database: +: name: default namespace: AppBundle\Model package: src.AppBundle.Model defaultIdMethod: native +behavior: - auto_add_pk table: +: {allowPkInsert: true} id: {type: INTEGER, size: 10, primaryKey: true, autoIncrement: true} column: varchar(64) column2: int column3: text key(8) column4: tinyint uniq column5: bool = 1 column6: - datetime +unique: - column(32) +index: [column2] +behavior: - timestampable - sortable: {use_scope: true, scope_column: column2} table2: id: int(10) ~pk table_id: int column: text = Default value column2: int +foreign-key: - table: {local: table_id, foreign: id} +behavior: - timestampable - sortable: column2 table3: table_id: int pk > table.id table2_id: int pk > table2.id(restrict cascade)