Basic table definition
- PostgreSQL
- MySQL
- SQLite
Table with constraints
Add indexes, foreign keys, and other constraints using the third parameter:- PostgreSQL
- MySQL
- SQLite
The third parameter must return an array of constraint builders, not an object. The object syntax is deprecated.
Column types function
Use the callback syntax to access column builders directly:Custom table names
Create a table creator for custom prefixes:Schema namespaces
PostgreSQL and MySQL support schema namespaces:Row-level security (PostgreSQL)
Enable RLS on PostgreSQL tables:Complete example
API reference
string
required
The table name in the database
object | function
required
Column definitions as an object or callback function that receives column builders
function
Optional callback that receives the table columns and returns an array of constraints (indexes, foreign keys, etc.)