Model XML Reference

Bedrock's model components use XML to import and export database structure as well as data. The definition of databases, their tables, and each tables' columns and records can be nested within each other and defined in a single XML file, or can they can be separated into different files. Using separate files is generally recommended for maintainability's sake, using one file per table definition, one file per database definition, and data exports grouped by table in separate files.

XML Tag Heirarchy

Database Definition

The following tags are used to define database properties and attributes.

DATABASE Description
Describes a database and its associated properties. It may also contain nested table definitions.
Subtags
tables
Attribute Type Possible Values Description
name string * A name for the database.
TABLES Description
A container for table definitions for the defining database.
Subtags
table

Table Definition

Table definitions can contain both table schemas as well as corresponding data. For most cases, it is recommended that you do not combine table schema definitions with actual record data. The only exception being in cases where a particular table must include some initial data at the time of creation (i.e. an admin account record for a users table).

TABLE Description
Contains a single table definition and associated columns. Record data can also be stored within.
Subtags
properties, columns, records
Attribute Type Possible Values Description
name string * A valid table name.
PROPERTIES Description
A container for all table properties, such as the encoding type, character set, storage engine, etc.
COLUMNS Description
A container for all table columns.
Subtags
column

Columns

COLUMN Description
Contains the properties for a single column.
Subtags
type, length, size, default, comments, flags
Attribute Type Possible Values Description
name string * A valid column name.
TYPE Description
The containing column's data type (i.e. varchar, int, bit, etc.).
LENGTH Description
If the column type is string-like, the maximum number of allowed characters goes here.
SIZE Description
If the column type requires a storage limit, the size (usually in bytes) is defined here.
DEFAULT Description
Defines an optional default value for the column if a record does not specify one.
COMMENTS Description
Any user comments describing the purpose of the column, or anything else, can go here.
FLAGS Description
A container for additional flags that can be set for the column.
Subtags
primarykey, autoincrement, unique, null
PRIMARYKEY Description
Wether or not the containing column is the primary key for its table.
AUTOINCREMENT Description
If the column is a numeric data type, setting this to true will set the column to auto-increment it's value on each subsequent record.
UNIQUE Description
Whether or not a unique constraint should be applied to the column.
NULL Description
Whether or not NULL values are allowed for the containing column.

Records