Schema class

Schema builder for creating database tables

This class provides a fluent interface for defining table schemas with proper column types, constraints, and relationships.

Example usage:

final schema = Schema()
  ..id()
  ..text('name').notNull()
  ..integer('age').defaultValue(18)
  ..timestamps();

final createTableQuery = schema.createTable('users');

Constructors

Schema.new()

Properties

columnCount int
Get the number of columns
no setter
columnNames List<String>
Get the list of column names
no setter
hasColumns bool
Check if the schema has any columns
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

arc(String name) SchemaUtils
Add an arc column
auditTrail() → void
Add audit columns
blob(String name) SchemaUtils
Add a blob column
boolean(String name) SchemaUtils
Add a boolean column
circle(String name) SchemaUtils
Add a circle column
color(String name) SchemaUtils
Add a color column
complex(String name) SchemaUtils
Add a complex column
coordinates(String name) SchemaUtils
Add a coordinates column
createTable(String tableName) String
Create the table creation SQL
currency(String name) SchemaUtils
Add a currency column
curve(String name) SchemaUtils
Add a curve column
custom(String name, String sqlType) SchemaUtils
Add a custom column
datetime(String name) SchemaUtils
Add a datetime column
decimal(String name, {int precision = 10, int scale = 2}) SchemaUtils
Add a decimal column
duration(String name) SchemaUtils
Add a duration column
ellipse(String name) SchemaUtils
Add an ellipse column
email(String name) SchemaUtils
Add an email column
filePath(String name) SchemaUtils
Add a file path column
foreignId(String name) SchemaUtils
Add a foreign key column
fraction(String name) SchemaUtils
Add a fraction column
hash(String name, {int length = 64}) SchemaUtils
Add a hash column
override
id([String name = "id"]) → void
Add a primary key column
integer(String name) SchemaUtils
Add an integer column
ipAddress(String name) SchemaUtils
Add an IP address column
json(String name) SchemaUtils
Add a JSON column
line(String name) SchemaUtils
Add a line column
macAddress(String name) SchemaUtils
Add a MAC address column
matrix(String name) SchemaUtils
Add a matrix column
mixed(String name) SchemaUtils
Add a mixed column
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
percentage(String name) SchemaUtils
Add a percentage column
phone(String name) SchemaUtils
Add a phone column
point(String name) SchemaUtils
Add a point column
polygon(String name) SchemaUtils
Add a polygon column
quaternion(String name) SchemaUtils
Add a quaternion column
rational(String name) SchemaUtils
Add a rational column
real(String name) SchemaUtils
Add a real (floating point) column
rectangle(String name) SchemaUtils
Add a rectangle column
softDeletes() → void
Add soft delete columns
surface(String name) SchemaUtils
Add a surface column
text(String name) SchemaUtils
Add a text column
timestamps() → void
Add timestamp columns
token(String name) SchemaUtils
Add a token column
toString() String
A string representation of this object.
inherited
triangle(String name) SchemaUtils
Add a triangle column
url(String name) SchemaUtils
Add a URL column
uuid(String name) SchemaUtils
Add a UUID column
varchar(String name, int length) SchemaUtils
Add a varchar column
vector(String name) SchemaUtils
Add a vector column
volume(String name) SchemaUtils
Add a volume column

Operators

operator ==(Object other) bool
The equality operator.
inherited