DbTable class

The class used to create tables

Constructors

DbTable(String name)
Default constructor

Properties

columns List<DbColumn>
The columns info
no setter
constraints List<String>
Get the table constraints
no setter
foreignKeys List<DbColumn>
The foreign key columns
no setter
hashCode int
The hash code for this object.
no setterinherited
name String
Name of the table: no spaces
final
queries List<String>
Get the list of queries to perform for database initialization
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

blob(String name, {bool nullable = false, bool unique = false, Uint8List? defaultValue, String? check}) → void
Add a blob column
boolean(String name, {required bool defaultValue}) → void
Add a float column
column(String name) DbColumn?
Get a column by name
describe({String spacer = ""}) → void
print a description of the schema
foreignKey(String name, {String? reference, bool nullable = false, bool unique = false, String? defaultValue, OnDelete onDelete = OnDelete.restrict}) → void
Add a foreign key to a column
hasColumn(String name) bool
Check if a column exists
index(String column, {String? indexName}) → void
Add an index to a column
integer(String name, {bool nullable = false, bool unique = false, int? defaultValue, String? check}) → void
Add an integer column
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
printQueries() → void
Print the queries to perform for database initialization
queryString() String
The string for the table create query
real(String name, {bool nullable = false, bool unique = false, double? defaultValue, String? check}) → void
Add a float column
text(String name, {bool nullable = false, bool unique = false, String? defaultValue, String? check}) → void
Add a text column
timestamp([String name = "timestamp"]) → void
Add an automatic timestamp
toString() String
A string representation of this object.
override
uniqueTogether(String column1, String column2) → void
Add a unique constraint for combined values from two columns
varchar(String name, {int? maxLength, bool nullable = false, bool unique = false, String? defaultValue, String? check}) → void
Add a varchar column

Operators

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