SchemaBuilder class

Fluent builder that collects schema commands for a migration direction.

Constructors

SchemaBuilder({SchemaSnapshot? snapshot, String? defaultSchema, String? tablePrefix})

Properties

hashCode int
The hash code for this object.
no setterinherited
hasSnapshot bool
Returns true when this builder was constructed with a SchemaSnapshot.
no setter
inspector SchemaInspector
Lazily exposes an inspector backed by the captured SchemaSnapshot.
no setter
isEmpty bool
Returns true when no commands were recorded.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build({String? description}) SchemaPlan
Finalizes the plan captured by this builder.
columnType(String table, String column, {String? schema}) String?
Returns the column type for the requested table/column if available.
create(String table, void definition(TableBlueprint table), {String? schema}) TableBlueprint
Builds a CREATE TABLE command.
createCollection(String collection, {Map<String, Object?>? validator, Map<String, Object?>? options}) → void
Registers Mongo-style create collection command.
createDatabase(String name, {Map<String, Object?>? options}) → void
Creates a new database with optional driver-specific options.
createIndex({required String collection, required Map<String, Object?> keys, Map<String, Object?>? options}) → void
Registers Mongo-style create index command.
drop(String table, {bool ifExists = false, bool cascade = false}) → void
Registers a drop table command.
dropCollection(String collection) → void
Registers Mongo-style drop collection command.
dropDatabase(String name) → void
Drops a database.
dropDatabaseIfExists(String name) → void
Drops a database if it exists.
dropIndex({required String collection, required String name}) → void
Registers Mongo-style drop index command.
hasColumn(String table, String column, {String? schema}) bool
Returns true if a column exists within the captured snapshot.
hasTable(String table, {String? schema}) bool
Returns true if a table exists within the captured snapshot.
modifyValidator({required String collection, required Map<String, Object?> validator}) → void
Registers Mongo-style validator modification command.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
raw(String sql, {List<Object?> parameters = const []}) → void
Appends a raw SQL command.
rename(String from, String to) → void
Registers a rename table command.
table(String table, void definition(TableBlueprint table), {String? schema}) TableBlueprint
Builds an ALTER TABLE command.
tableListing({String? schema, bool schemaQualified = true}) List<String>
Lists tables from the snapshot (optionally schema-qualified).
toString() String
A string representation of this object.
inherited

Operators

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