concretecms / doctrine-xml
使用 Doctrine 数据类型通过 XML 定义数据库结构
1.3.0
2022-07-07 22:35 UTC
Requires
- php: >=5.3
Requires (Dev)
- doctrine/dbal: 2.5.*
README
Doctrine 数据库模式的一个 XML 表示
在线归一化和验证工具
https://concretecms.github.io/doctrine-xml/
完整示例
以下是一个包含 Doctrine XML 提供的所有功能的示例。请注意,头部行 xmlns:xsi="..."
和 xsi:schemaLocation="..."
不是必需的,但如果你使用的 XML 编辑器支持自动完成,它们可能是有用的。
<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.concrete5.org/doctrine-xml/0.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.concrete5.org/doctrine-xml/0.5 https://concretecms.github.io/doctrine-xml/doctrine-xml-0.5.xsd" > <table name="Companies" comment="List of companies"> <field name="Id" type="integer" comment="Record identifier"> <unsigned /> <autoincrement /> <key /> </field> <field name="Name" type="string" size="50" comment="Company name"> <notnull /> <opt for="mysql" collation="utf8_bin" /> </field> <opt for="mysql" engine="InnoDB" charset="utf8" collate="utf8_unicode_ci" row_format="compact" /> </table> <table name="Employees" engine="INNODB"> <field name="Id" type="integer"> <unsigned /> <autoincrement /> <key /> </field> <field name="IdentificationCode" type="string" size="20"> <fixed /> </field> <field name="Company" type="integer"> <unsigned /> <notnull /> </field> <field name="FirstName" type="string" size="50"> <default value="" /> <notnull /> </field> <field name="LastName" type="string" size="50"> <notnull /> </field> <field name="Income" type="decimal" size="10.2"> <default value="1000" /> </field> <field name="HiredOn" type="datetime"> <deftimestamp /> </field> <index> <fulltext /> <col>FirstName</col> </index> <index name="IX_EmployeesIdentificationCode"> <unique /> <col>IdentificationCode</col> </index> <references table="Companies" onupdate="cascade" ondelete="restrict"> <column local="Company" foreign="Id" /> </references> </table> </schema>