Defining a Schema
Last updated Oct 17th, 2026 | Page history | Improve this page | Report an issue
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn moreWhat is a Schema?¶
xPDO generates its map and class files, which power the database relationships, from XML schema files. An XML schema is based on a package that defines the name of the schema and allows xPDO to load the schema with its classes dynamically at any time using xPDO.addPackage.
Schema Version¶
For xPDO 3.x (used in MODX 3), schemas must use version="3.0". This version enables PSR-4 autoloading and the metadata.{dbtype}.php envelope. If you have an older 1.1 schema, see Upgrading Models to Schema Version 1.1 for information on migrating your index definitions, then update the version to 3.0.
- Defining the Database and Tables
- Upgrading Models to Schema Version 1.1
- Defining Relationships
- Validation Rules
- More Examples of xPDO XML Schema Files
Support the team building MODX with a monthly donation.
The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.
Backers
Budget
$194 per month—let's make that $500!
Learn more










