Deklara Reference

Deklara Schemas

A Deklara schema file consists of a sequence of declaration

where declaration is:
  • table table_name (named_table_constraint|column_definition[ ,... ]) ';'
  • [unique] index [constraint_name] on table_name (column_name[ ,... ]) ';'
  • sequence column_name [owned by {none|table_name '.' column_name}] ';'

Deklara Migrations

A Deklara migration consists of a sequence of ddl_statement

where ddl_statement is:
  • create table table_name (named_table_constraint|column_definition[ ,... ]) ';'
  • create [unique] index [constraint_name] on table_name (column_name[ ,... ]) ';'
  • create sequence column_name [owned by {none|table_name '.' column_name}] ';'
  • drop {table table_name|index table_name|sequence column_name} ';'
  • alter {table table_name table_op|sequence_declaration} ';'
where table_op is:
  • add {column column_name column_type named_column_constraint|named_table_constraint}
  • drop {column column_name|constraint constraint_name}
  • rename {to table_name|[column] column_name to column_name}
  • alter column column_name column_op
where column_op is:
  • set {not null|default expression}
  • drop {not null|default}
  • type column_type [using expression]

Common Rules

where column_definition is:
column_name column_type named_column_constraint
where named_column_constraint is:
[constraint constraint_name] column_constraint
where column_constraint is:
  • null
  • not null
  • references table_name (column_name[ ,... ])
  • primary key
  • unique
  • default expression
where named_table_constraint is:
[constraint constraint_name] table_constraint
where table_constraint is:
  • foreign key (column_name[ ,... ]) references table_name (column_name[ ,... ])
  • primary key (column_name[ ,... ])
  • unique (column_name[ ,... ])