Skip to main content

SQL Server Schema

data​

The data block defines seed/lookup data for a table.

data {
table = table.countries
rows = [
{ code = "US", name = "United States" },
{ code = "CA", name = "Canada" },
]
}

data attributes​

NameRequiredValue
rowstrue

Any value

tabletrue

Object reference to table

data constraints​

ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

fulltext_catalog​

fulltext_catalog attributes​

NameRequiredValue
accent_sensitivityfalsebool
defaultfalsebool
filegroupfalsestring
ownerfalsestring

fulltext_catalog constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., fulltext_catalog "name" )true
Repeatabletrue

function​

The function block describes a function in a database schema.

function "positive" {
schema = schema.public
lang = SQL
arg "v" {
type = integer
}
...
}

function attributes​

NameRequiredValue
astruestring
commentfalsestring
depends_onfalse

List of object references

execute_asfalse

The execution context of the function can be one of:

  1. Raw expression defined with sql("expr")
  2. string
inlinefalsebool
langtrue

Function language can be one of:

  1. string
  2. enum (SQL, CRL)
native_compilationfalsebool
null_callfalse

enum (CALLED, RETURNS_NULL)

returnfalse

Function return type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
  3. Object reference to type_alias
schematrue

Object reference to schema

schema_boundfalsebool

function blocks​

function.annotation​

function.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

function.arg​

function.arg attributes​
NameRequiredValue
defaultfalse

Function argument default value can be one of:

  1. bool
  2. Raw expression defined with sql("expr")
  3. string
  4. number
modefalse

Function argument mode can be one of:

  1. string
  2. enum (IN, INOUT, OUT)
readonlyfalsebool
typetrue

Function argument type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
  3. Object reference to type_alias
  4. Object reference to type_table
function.arg constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

function.return_table​

function.return_table blocks​

function.return_table.check​

function.return_table.check attributes​
NameRequiredValue
exprtruestring
function.return_table.check constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

function.return_table.column​

function.return_table.column attributes​
NameRequiredValue
asfalsestring
collatefalsestring
commentfalsestring
defaultfalse

Column default value can be one of:

  1. bool
  2. string
  3. number
  4. Raw expression defined with sql("expr")
nullfalsebool
renamed_fromfalsestring
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
  3. Object reference to type_alias
function.return_table.column blocks​

function.return_table.column.annotation​

function.return_table.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

function.return_table.column.as​

function.return_table.column.as attributes​
NameRequiredValue
exprtruestring
typefalse

enum (PERSISTED)

function.return_table.column.identity​

function.return_table.column.identity attributes​
NameRequiredValue
incrementfalseint
seedfalseint
function.return_table.column constraints​
ConstraintValue
Requiredtrue
Require Name (e.g., function.return_table.column "name" )true
Mutually exclusive sets[as (attribute), as (block)]

function.return_table.index​

function.return_table.index attributes​
NameRequiredValue
columnsfalse

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
includefalse

Index included columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
nonclusteredfalsebool
renamed_fromfalsestring
function.return_table.index blocks​

function.return_table.index.on​

function.return_table.index.on attributes​
NameRequiredValue
columntrue

Index columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
function.return_table.index.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
function.return_table.index constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., function.return_table.index "name" )true
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

function.return_table.primary_key​

function.return_table.primary_key attributes​
NameRequiredValue
columnsfalse

Primary key columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
commentfalsestring
fill_factorfalseint
includefalse

Primary key included columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
nonclusteredfalsebool
typefalse

Index key type can be one of:

  1. string
  2. enum (HASH)
function.return_table.primary_key blocks​

function.return_table.primary_key.on​

function.return_table.primary_key.on attributes​
NameRequiredValue
columntrue

Primary key columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
function.return_table.primary_key.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
function.return_table.primary_key constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

function.return_table.unique​

The unique block defines a unique constraint on a table or view. It can be used to ensure that the values in a column or a set of columns are unique across the table.

Creating a unique constraint will automatically create a unique index on the specified columns.

function.return_table.unique attributes​
NameRequiredValue
columnsfalse

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
fill_factorfalseint
nonclusteredfalsebool
function.return_table.unique blocks​

function.return_table.unique.on​

function.return_table.unique.on attributes​
NameRequiredValue
columnfalse

Constraint columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
function.return_table.unique.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Mutually exclusive sets[column, expr]
function.return_table.unique constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Mutually exclusive sets[columns, on]
One of required sets[columns, on]
function.return_table constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., function.return_table "name" )true

function constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., function "name" )true
Allow Qualifier (e.g., function "schema" "name" )true

partition_function​

partition_function attributes​

NameRequiredValue
inputtrue

Partition function input type can be one of:

  1. Schema type
  2. Object reference to type_alias
rangefalse

enum (LEFT, RIGHT)

valuesfalse

List of strings

partition_function constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., partition_function "name" )true
Repeatabletrue

partition_scheme​

partition_scheme attributes​

NameRequiredValue
filegroupstrue

List of strings

partitiontrue

Object reference to partition_function

partition_scheme constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., partition_scheme "name" )true
Repeatabletrue

permission​

The permission block describes permissions (privileges) granted on database objects.

permission {
to = "user1"
for = table.users
privileges = [SELECT, INSERT]
}

permission {
to = "admin"
for = schema.dbo
privileges = [CONTROL]
grantable = true
}

permission attributes​

NameRequiredValue
fortrue

Permission target resource can be one of:

  1. Object reference to schema
  2. Object reference to table
  3. Object reference to view
  4. Object reference to function
  5. Object reference to procedure
  6. Object reference to type_alias
  7. Object reference to type_table
  8. Object reference to table.column
  9. Object reference to view.column
grantablefalsebool
privilegestrue

List of strings

totrue

Permission grantee (name or user/role reference) can be one of:

  1. string
  2. Object reference to role
  3. Object reference to user

permission constraints​

ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

procedure​

The procedure block describes a procedure in a database schema.

procedure "proc" {
schema = schema.public
lang = SQL
arg "a" {
type = integer
}
...
}

procedure attributes​

NameRequiredValue
astruestring
commentfalsestring
depends_onfalse

List of object references

execute_asfalse

The execution context of the procedure can be one of:

  1. Raw expression defined with sql("expr")
  2. string
for_replicationfalsebool
langtrue

Procedure language can be one of:

  1. string
  2. enum (SQL, CRL)
native_compilationfalsebool
recompilefalsebool
schematrue

Object reference to schema

schema_boundfalsebool

procedure blocks​

procedure.annotation​

procedure.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

procedure.arg​

procedure.arg attributes​
NameRequiredValue
defaultfalse

Procedure argument default value can be one of:

  1. bool
  2. Raw expression defined with sql("expr")
  3. string
  4. number
modefalse

Procedure argument mode can be one of:

  1. string
  2. enum (IN, INOUT, OUT)
readonlyfalsebool
typetrue

Procedure argument type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
  3. Object reference to type_alias
  4. Object reference to type_table
procedure.arg constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., procedure.arg "name" )true

procedure constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., procedure "name" )true
Allow Qualifier (e.g., procedure "schema" "name" )true

role​

role attributes​

NameRequiredValue
allow_encrypted_value_modificationsfalsebool
commentfalsestring
default_languagefalsestring
default_schemafalse

Schema name or reference can be one of:

  1. string
  2. Object reference to schema
login_namefalsestring
member_offalse

List of object reference to role

role constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., role "name" )true
Repeatabletrue

schema​

The schema block describes a database schema.

schema "public" {
...
}

schema attributes​

NameRequiredValue
namefalsestring

schema blocks​

schema.annotation​

schema.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

schema constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., schema "name" )true

sequence​

The sequence block describes a sequence in a database schema.

sequence "name" {
schema = schema.public
type = int
increment = 3
min_value = 9
}

sequence attributes​

NameRequiredValue
cachefalseint
cyclefalsebool
incrementfalseint
max_valuefalseint
min_valuefalseint
schematrue

Object reference to schema

startfalseint
typefalse

Sequence type can be one of:

  1. Schema type
  2. Object reference to type_alias

sequence blocks​

sequence.annotation​

sequence.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

sequence constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., sequence "name" )true
Allow Qualifier (e.g., sequence "schema" "name" )true

table​

The table block describes a table in a database schema.

table "users" {
schema = schema.public
column "id" {
type = int
}
...
}

table attributes​

NameRequiredValue
commentfalsestring
depends_onfalse

List of object references

graphfalse

enum (NODE, EDGE)

memory_optimizedfalsebool
renamed_fromfalsestring
schematrue

Object reference to schema

system_versionedfalsebool

table blocks​

table.annotation​

table.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

table.check​

table.check attributes​
NameRequiredValue
exprtruestring
table.check constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

table.column​

table.column attributes​
NameRequiredValue
asfalsestring
collatefalsestring
commentfalsestring
defaultfalse

Column default value can be one of:

  1. bool
  2. string
  3. number
  4. Raw expression defined with sql("expr")
nullfalsebool
renamed_fromfalsestring
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
  3. Object reference to type_alias
table.column blocks​

table.column.annotation​

table.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

table.column.as​

table.column.as attributes​
NameRequiredValue
exprtruestring
typefalse

enum (PERSISTED)

table.column.default​

table.column.default attributes​
NameRequiredValue
astrue

Column default value can be one of:

  1. bool
  2. string
  3. number
  4. Raw expression defined with sql("expr")
table.column.default constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., table.column.default "name" )true

table.column.generated_always​

table.column.generated_always attributes​
NameRequiredValue
astrue

enum (ROW_START, ROW_END, TRANSACTION_ID_START, TRANSACTION_ID_END, SEQUENCE_NUMBER_START, SEQUENCE_NUMBER_END)

hiddenfalsebool

table.column.identity​

table.column.identity attributes​
NameRequiredValue
incrementfalseint
seedfalseint
table.column constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., table.column "name" )true
Mutually exclusive sets[as (attribute), as (block)]

table.connection​

table.connection attributes​
NameRequiredValue
on_deletetrue

enum (NO_ACTION, CASCADE)

table.connection blocks​

table.connection.clause​

table.connection.clause attributes​
NameRequiredValue
fromtrue

Object reference to table

totrue

Object reference to table

table.connection.clause constraints​
ConstraintValue
Requiredtrue
Require Namefalse
Repeatabletrue
table.connection constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., table.connection "name" )true

table.foreign_key​

table.foreign_key attributes​
NameRequiredValue
columnstrue

Foreign key columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
commentfalsestring
on_deletefalse

enum (NO_ACTION, RESTRICT, CASCADE, SET_NULL, SET_DEFAULT)

on_updatefalse

enum (NO_ACTION, RESTRICT, CASCADE, SET_NULL, SET_DEFAULT)

ref_columnstrue

Foreign key reference columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
table.foreign_key constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., table.foreign_key "name" )true

table.fulltext​

table.fulltext attributes​
NameRequiredValue
catalogfalse

Fulltext catalog can be one of:

  1. string
  2. Object reference to fulltext_catalog
columnsfalse

List of object reference to column

filegroupfalsestring
primary_keyfalsebool
unique_keyfalse

Object reference to index

table.fulltext blocks​

table.fulltext.on​

table.fulltext.on attributes​
NameRequiredValue
columntrue

Object reference to column

languagefalsestring
semanticfalsebool
typefalse

Object reference to column

table.fulltext.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
table.fulltext constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Mutually exclusive sets[primary_key, unique_key], [columns, on]
One of required sets[primary_key, unique_key], [columns, on]

table.index​

table.index attributes​
NameRequiredValue
cells_per_objectfalseint
columnsfalse

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
commentfalsestring
fill_factorfalseint
includefalse

Index included columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
nonclusteredfalsebool
renamed_fromfalsestring
tessellation_schemefalse

enum (GEOMETRY_GRID, GEOMETRY_AUTO_GRID, GEOGRAPHY_GRID, GEOGRAPHY_AUTO_GRID)

typefalse

Index key type can be one of:

  1. string
  2. enum (COLUMNSTORE, HASH, HEAP, SPATIAL, XML)
uniquefalsebool
wherefalsestring
table.index blocks​

table.index.bounding_box​

table.index.bounding_box attributes​
NameRequiredValue
xmaxtruenumber
xmintruenumber
ymaxtruenumber
ymintruenumber

table.index.grids​

table.index.grids attributes​
NameRequiredValue
level_1false

enum (LOW, MEDIUM, HIGH)

level_2false

enum (LOW, MEDIUM, HIGH)

level_3false

enum (LOW, MEDIUM, HIGH)

level_4false

enum (LOW, MEDIUM, HIGH)

table.index.on​

table.index.on attributes​
NameRequiredValue
columntrue

Index columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
table.index.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
table.index constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., table.index "name" )true
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

table.partition​

table.partition attributes​
NameRequiredValue
columntrue

Object reference to column

schemetrue

Partition scheme can be one of:

  1. Object reference to partition_scheme
  2. string

table.period​

table.period attributes​
NameRequiredValue
endtrue

Object reference to column

starttrue

Object reference to column

typetrue

enum (SYSTEM_TIME)

table.period constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., table.period "name" )true

table.primary_key​

table.primary_key attributes​
NameRequiredValue
columnsfalse

Primary key columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
commentfalsestring
fill_factorfalseint
includefalse

Primary key included columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
nonclusteredfalsebool
typefalse

Index key type can be one of:

  1. string
  2. enum (HASH)
table.primary_key blocks​

table.primary_key.on​

table.primary_key.on attributes​
NameRequiredValue
columntrue

Primary key columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
table.primary_key.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
table.primary_key constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

table.system_versioned​

table.system_versioned attributes​
NameRequiredValue
history_tablefalsestring
retentionfalseint
retention_unitfalse

enum (DAY, WEEK, MONTH, YEAR)

table.unique​

The unique block defines a unique constraint on a table or view. It can be used to ensure that the values in a column or a set of columns are unique across the table.

Creating a unique constraint will automatically create a unique index on the specified columns.

table.unique attributes​
NameRequiredValue
columnsfalse

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
fill_factorfalseint
nonclusteredfalsebool
table.unique blocks​

table.unique.on​

table.unique.on attributes​
NameRequiredValue
columnfalse

Constraint columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
table.unique.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Mutually exclusive sets[column, expr]
table.unique constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

table constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., table "name" )true
Allow Qualifier (e.g., table "schema" "name" )true
Mutually exclusive sets[graph, memory_optimized], [graph, system_versioned]

trigger​

The trigger block describes a trigger on a table in a database schema.

trigger "trigger_orders_audit" {
on = table.orders
...
}

trigger attributes​

NameRequiredValue
astruestring
execute_asfalse

The execution context of the trigger can be one of:

  1. Raw expression defined with sql("expr")
  2. string
namefalsestring
ontrue

Trigger on can be one of:

  1. Object reference to table
  2. Object reference to view
schema_boundfalsebool

trigger blocks​

trigger.after​

trigger.after attributes​
NameRequiredValue
deletefalsebool
insertfalsebool
updatefalsebool
trigger.after constraints​
ConstraintValue
Requiredfalse
Require Namefalse
One of required sets[insert, delete, update]

trigger.annotation​

trigger.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

trigger.instead_of​

trigger.instead_of attributes​
NameRequiredValue
deletefalsebool
insertfalsebool
updatefalsebool
trigger.instead_of constraints​
ConstraintValue
Requiredfalse
Require Namefalse
One of required sets[insert, delete, update]

trigger constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., trigger "name" )true
Repeatabletrue
Mutually exclusive sets[after, instead_of]
One of required sets[after, instead_of]

type_alias​

type_alias attributes​

NameRequiredValue
nullfalsebool
schematrue

Object reference to schema

typetrue

Base type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")

type_alias constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., type_alias "name" )true
Allow Qualifier (e.g., type_alias "schema" "name" )true

type_table​

type_table attributes​

NameRequiredValue
schematrue

Object reference to schema

type_table blocks​

type_table.check​

type_table.check attributes​
NameRequiredValue
exprtruestring
type_table.check constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue

type_table.column​

type_table.column attributes​
NameRequiredValue
asfalsestring
collatefalsestring
commentfalsestring
defaultfalse

Column default value can be one of:

  1. bool
  2. string
  3. number
  4. Raw expression defined with sql("expr")
nullfalsebool
renamed_fromfalsestring
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
  3. Object reference to type_alias
type_table.column blocks​

type_table.column.annotation​

type_table.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

type_table.column.as​

type_table.column.as attributes​
NameRequiredValue
exprtruestring
typefalse

enum (PERSISTED)

type_table.column.identity​

type_table.column.identity attributes​
NameRequiredValue
incrementfalseint
seedfalseint
type_table.column constraints​
ConstraintValue
Requiredtrue
Require Name (e.g., type_table.column "name" )true
Mutually exclusive sets[as (attribute), as (block)]

type_table.index​

type_table.index attributes​
NameRequiredValue
columnsfalse

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
includefalse

Index included columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
nonclusteredfalsebool
renamed_fromfalsestring
type_table.index blocks​

type_table.index.on​

type_table.index.on attributes​
NameRequiredValue
columntrue

Index columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
type_table.index.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
type_table.index constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., type_table.index "name" )true
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

type_table.primary_key​

type_table.primary_key attributes​
NameRequiredValue
columnsfalse

Primary key columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
commentfalsestring
fill_factorfalseint
includefalse

Primary key included columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
nonclusteredfalsebool
typefalse

Index key type can be one of:

  1. string
  2. enum (HASH)
type_table.primary_key blocks​

type_table.primary_key.on​

type_table.primary_key.on attributes​
NameRequiredValue
columntrue

Primary key columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
type_table.primary_key.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
type_table.primary_key constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

type_table.unique​

The unique block defines a unique constraint on a table or view. It can be used to ensure that the values in a column or a set of columns are unique across the table.

Creating a unique constraint will automatically create a unique index on the specified columns.

type_table.unique attributes​
NameRequiredValue
columnsfalse

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
fill_factorfalseint
nonclusteredfalsebool
type_table.unique blocks​

type_table.unique.on​

type_table.unique.on attributes​
NameRequiredValue
columnfalse

Constraint columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
type_table.unique.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Mutually exclusive sets[column, expr]
type_table.unique constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

type_table constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., type_table "name" )true
Allow Qualifier (e.g., type_table "schema" "name" )true

user​

user attributes​

NameRequiredValue
allow_encrypted_value_modificationsfalsebool
commentfalsestring
default_languagefalsestring
default_schemafalse

Schema name or reference can be one of:

  1. string
  2. Object reference to schema
login_namefalsestring
member_offalse

List of object reference to role

user constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., user "name" )true
Repeatabletrue

view​

The view block describes a view in a database schema.

view "clean_users" {
schema = schema.public
column "id" {
type = int
}
...
}

view attributes​

NameRequiredValue
astruestring
check_optionfalse

enum (LOCAL, LOCAL, CASCADED)

commentfalsestring
depends_onfalse

List of object references

schematrue

Object reference to schema

schema_boundfalsebool

view blocks​

view.annotation​

view.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue

view.column​

view.column attributes​
NameRequiredValue
nullfalsebool
typetrue

Column type can be one of:

  1. Schema type
  2. Raw expression defined with sql("expr")
  3. Object reference to type_alias
view.column blocks​

view.column.annotation​

view.column.annotation constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Allow unknown blockstrue
Allow unknown attributestrue
view.column constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., view.column "name" )true

view.fulltext​

view.fulltext attributes​
NameRequiredValue
catalogfalse

Fulltext catalog can be one of:

  1. string
  2. Object reference to fulltext_catalog
columnsfalse

List of object reference to column

filegroupfalsestring
primary_keyfalsebool
unique_keyfalse

Object reference to index

view.fulltext blocks​

view.fulltext.on​

view.fulltext.on attributes​
NameRequiredValue
columntrue

Object reference to column

languagefalsestring
semanticfalsebool
typefalse

Object reference to column

view.fulltext.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
view.fulltext constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Mutually exclusive sets[primary_key, unique_key], [columns, on]
One of required sets[primary_key, unique_key], [columns, on]

view.index​

view.index attributes​
NameRequiredValue
cells_per_objectfalseint
columnsfalse

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
commentfalsestring
fill_factorfalseint
includefalse

Index included columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
nonclusteredfalsebool
renamed_fromfalsestring
tessellation_schemefalse

enum (GEOMETRY_GRID, GEOMETRY_AUTO_GRID, GEOGRAPHY_GRID, GEOGRAPHY_AUTO_GRID)

typefalse

Index key type can be one of:

  1. string
  2. enum (COLUMNSTORE, HASH, HEAP, SPATIAL, XML)
uniquefalsebool
wherefalsestring
view.index blocks​

view.index.bounding_box​

view.index.bounding_box attributes​
NameRequiredValue
xmaxtruenumber
xmintruenumber
ymaxtruenumber
ymintruenumber

view.index.grids​

view.index.grids attributes​
NameRequiredValue
level_1false

enum (LOW, MEDIUM, HIGH)

level_2false

enum (LOW, MEDIUM, HIGH)

level_3false

enum (LOW, MEDIUM, HIGH)

level_4false

enum (LOW, MEDIUM, HIGH)

view.index.on​

view.index.on attributes​
NameRequiredValue
columntrue

Index columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
view.index.on constraints​
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
view.index constraints​
ConstraintValue
Requiredfalse
Require Name (e.g., view.index "name" )true
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

view constraints​

ConstraintValue
Requiredfalse
Require Name (e.g., view "name" )true
Allow Qualifier (e.g., view "schema" "name" )true