Skip to main content

Oracle Schema

schema

The schema block describes a database schema.

schema "public" {
...
}

schema attributes

NameRequiredValue
namefalsestring

schema constraints

ConstraintValue
Requiredfalse
Require Name (e.g., 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

schematrue

Object reference to schema

table blocks

table.check

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

table.column

table.column attributes
NameRequiredValue
asfalsestring
commentfalsestring
defaultfalse

Column default value can be one of:

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

Column type can be one of:

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

table.column.identity

table.column.identity attributes
NameRequiredValue
cachefalseint
cyclefalsebool
generatedfalse

enum (ALWAYS, BY_DEFAULT)

incrementfalseint
max_valuefalseint
min_valuefalseint
orderfalsebool
startfalseint
table.column constraints
ConstraintValue
Requiredfalse
Require Name (e.g., table.column "name" )true
Mutually exclusive sets[as (attribute), as (block)]

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
on_deletefalse

enum (NO_ACTION, CASCADE, SET_NULL)

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.index

table.index attributes
NameRequiredValue
bitmapfalsebool
columnsfalse

Index columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
reversedfalsebool
uniquefalsebool
table.index blocks

table.index.on

table.index.on attributes
NameRequiredValue
columnfalse

Index columns can be one of:

  1. Object reference to column
  2. Object reference to table.column
descfalsebool
exprfalsestring
table.index.on constraints
ConstraintValue
Requiredfalse
Require Namefalse
Repeatabletrue
Mutually exclusive sets[column, expr]
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.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
includefalse

Primary key included columns can be one of:

  1. List of object reference to column
  2. List of object reference to table.column
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 Name (e.g., table.primary_key "name" )true
Mutually exclusive sets[columns, on]
One of required sets[columns, on]

table.unique

table.unique attributes
NameRequiredValue
columnstrue

Index columns can be one of:

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

table constraints

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