ORT-SQL(1) General Commands Manual ORT-SQL(1)

ort-sql
produce ort SQL schema

ort-sql [config...]

The ort-sql utility accepts ort(5) config files, defaulting to standard input, and produces an SQL schema. The SQL generated is designed for sqlite3(1).

Output always begins with PRAGMA foreign_keys=ON regardless of whether the configuration has any references.

The schema begins of a series of CREATE TABLE SQL commands for each struct object in config. The name of the table inherits from the structure name.

Each field within each struct is mapped into a representative SQL type except the struct, which is a virtual type. The name of the column inherits from the field name.

Furthermore, types may have the following attributes.

If null is not specified, the SQL column is marked as NOT NULL. The default attribute is type-specific.

Reference types may contain the actup and actdel attributes map as follows:

These are assigned as FOREIGN KEY(xxx) REFERENCE yyy(zzz) followed by the update or delete clause, if applicable.

Lastly, any unique statement on the structure is rendered as the SQL UNIQUE(xxx, ...).

The ort-sql utility exits 0 on success, and >0 if an error occurs.

ort-sqldiff(1), sqlite3(1), ort(5)
July 17, 2019 OpenBSD 6.5