MySQL Schema
function
The function
block describes a function in a database schema.
function "positive" {
schema = schema.public
lang = SQL
arg "v" {
type = integer
}
...
}
Attributes
Name | Required | Value |
---|---|---|
as | true | string |
comment | false | string |
data_access | false |
|
deterministic | false | bool |
return | true | Function return type can be one of:
|
schema | true | Object reference to |
security | false |
|
Blocks
function.arg
function.arg
attributes
Name | Required | Value |
---|---|---|
charset | false | string |
collate | false | string |
mode | false |
|
type | true | Function argument type can be one of:
|
function.arg
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
procedure
The procedure
block describes a procedure in a database schema.
procedure "proc" {
schema = schema.public
lang = SQL
arg "a" {
type = integer
}
...
}
Attributes
Name | Required | Value |
---|---|---|
as | true | string |
comment | false | string |
data_access | false |
|
deterministic | false | bool |
schema | true | Object reference to |
security | false |
|
Blocks
procedure.arg
procedure.arg
attributes
Name | Required | Value |
---|---|---|
charset | false | string |
collate | false | string |
mode | false |
|
type | true | Procedure argument type can be one of:
|
procedure.arg
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
schema
The schema
block describes a database schema.
schema "public" {
...
}
Attributes
Name | Required | Value |
---|---|---|
charset | false | string |
collate | false | string |
collation | false | string |
comment | false | string |
name | false | string |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [collate, collation] |
table
The table
block describes a table in a database schema.
table "users" {
schema = schema.public
column "id" {
type = int
}
...
}
Attributes
Name | Required | Value |
---|---|---|
auto_increment | false | int |
charset | false | string |
collate | false | string |
comment | false | string |
engine | false | Table engine can be one of:
|
schema | true | Object reference to |
Blocks
table.check
table.check
attributes
Name | Required | Value |
---|---|---|
comment | false | string |
enforced | false | bool |
expr | true | string |
table.check
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
table.column
table.column
attributes
Name | Required | Value |
---|---|---|
as | false | string |
auto_increment | false | bool |
charset | false | string |
collate | false | string |
comment | false | string |
default | false | Column default value can be one of:
|
null | false | bool |
on_update | false | Raw expression defined with |
type | true | Column type can be one of:
|
unsigned | false | bool |
table.column
blocks
table.column.as
table.column.as
attributes
Name | Required | Value |
---|---|---|
expr | true | string |
type | false |
|
table.column.as
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
table.column
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [as (attribute), as (block)] |
table.foreign_key
table.foreign_key
attributes
Name | Required | Value |
---|---|---|
columns | true | Foreign key columns can be one of:
|
comment | false | string |
on_delete | false |
|
on_update | false |
|
ref_columns | true | Foreign key reference columns can be one of:
|
table.foreign_key
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
table.index
table.index
attributes
Name | Required | Value |
---|---|---|
columns | false | Index columns can be one of:
|
comment | false | string |
parser | false | Index parser can be one of:
|
type | false | Index key type can be one of:
|
unique | false | bool |
table.index
blocks
table.index.on
table.index.on
attributes
Name | Required | Value |
---|---|---|
column | false | Index columns can be one of:
|
desc | false | bool |
expr | false | string |
prefix | false | int |
table.index.on
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [column, expr] |
table.index
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [columns, on] |
One of required sets | [columns, on] |
table.primary_key
table.primary_key
attributes
Name | Required | Value |
---|---|---|
columns | false | Primary key columns can be one of:
|
comment | false | string |
type | false | Primary key type can be one of:
|
table.primary_key
blocks
table.primary_key.on
table.primary_key.on
attributes
Name | Required | Value |
---|---|---|
column | true | Index columns can be one of:
|
desc | false | bool |
prefix | false | int |
table.primary_key.on
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
table.primary_key
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [columns, on] |
One of required sets | [columns, on] |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
trigger
The trigger
block describes a trigger on a table in a database schema.
trigger "trigger_orders_audit" {
on = table.orders
...
}
Attributes
Name | Required | Value |
---|---|---|
as | true | string |
follows | false | Object reference to |
for | false |
|
foreach | false |
|
on | true | Object reference to |
precedes | false | Object reference to |
Blocks
trigger.after
trigger.after
attributes
Name | Required | Value |
---|---|---|
delete | false | bool |
insert | false | bool |
update | false | bool |
trigger.after
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [insert, delete, update] |
One of required sets | [insert, delete, update] |
trigger.before
trigger.before
attributes
Name | Required | Value |
---|---|---|
delete | false | bool |
insert | false | bool |
update | false | bool |
trigger.before
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [insert, delete, update] |
One of required sets | [insert, delete, update] |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | false |
Mutually exclusive sets | [foreach, for] , [follows, precedes] , [before, after] |
One of required sets | [before, after] |
view
The view
block describes a view in a database schema.
view "clean_users" {
schema = schema.public
column "id" {
type = int
}
...
}
Attributes
Name | Required | Value |
---|---|---|
as | true | string |
check_option | false |
|
comment | false | string |
depends_on | false | List of object references |
schema | true | Object reference to |
security | false |
|
Blocks
view.column
view.column
attributes
Name | Required | Value |
---|---|---|
comment | false | string |
null | false | bool |
type | true | Column type can be one of:
|
unsigned | false | bool |
view.column
constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|---|
Required | false |
Require Name | true |
Allow Qualifier | true |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |