Skip to main content

Column Constraints

OmniQL supports three column constraints using colon syntax:
:CREATE TABLE User WITH
  id:AUTO,
  email:STRING:NOTNULL:UNIQUE,
  name:STRING:NOTNULL
ConstraintSyntaxEffect
Not Null:NOTNULLColumn cannot be NULL
Unique:UNIQUEValues must be unique
Primary Key:PRIMARYKEYColumn is primary key

Multiple Constraints

Chain multiple constraints with colons:
:CREATE TABLE Product WITH
  id:AUTO,
  sku:STRING:NOTNULL:UNIQUE,
  name:STRING:NOTNULL,
  price:DECIMAL
DatabaseOutput
PostgreSQLCREATE TABLE products (id SERIAL PRIMARY KEY, sku VARCHAR NOT NULL UNIQUE, name VARCHAR NOT NULL, price DECIMAL)
MySQLCREATE TABLE products (id INT AUTO_INCREMENT PRIMARY KEY, sku VARCHAR(255) NOT NULL UNIQUE, name VARCHAR(255) NOT NULL, price DECIMAL)

Database-Specific Features

For advanced features like sequences, custom types, triggers, and stored procedures, see database-specific documentation:

Limitations

Not supported in OmniQL (use native SQL):
  • CHECK constraints
  • Foreign key references (REFERENCES)
  • ON DELETE / ON UPDATE actions
  • DEFAULT values
  • Composite primary keys

Next Steps