SchemaDriver class abstract

Contract implemented by database drivers that can execute schema plans and introspect live database metadata.

class MySaneDriver implements SchemaDriver {
  // implement members...
}
Implementers

Constructors

SchemaDriver()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

applySchemaPlan(SchemaPlan plan) Future<void>
Executes the given plan, typically inside a transaction when supported.
createDatabase(String name, {Map<String, Object?>? options}) Future<bool>
Creates a new database with the given name.
createSchema(String name) Future<bool>
Creates a new schema/namespace within the current database.
describeSchemaPlan(SchemaPlan plan) SchemaPreview
Returns a preview of the SQL statements that would run for plan.
disableForeignKeyConstraints() Future<bool>
Disables foreign key constraint checking. Returns true if successful.
dropAllTables({String? schema}) Future<void>
Drops all tables from the database. Automatically handles foreign key constraints.
dropDatabase(String name) Future<bool>
Drops a database with the given name. Throws if database doesn't exist.
dropDatabaseIfExists(String name) Future<bool>
Drops a database if it exists. Returns true if dropped, false if didn't exist.
dropSchemaIfExists(String name) Future<bool>
Drops a schema/namespace if it exists.
enableForeignKeyConstraints() Future<bool>
Enables foreign key constraint checking. Returns true if successful.
getCurrentSchema() Future<String>
Gets the current schema/namespace being used.
hasColumn(String table, String column, {String? schema}) Future<bool>
Determines if the given table has a specific column.
hasColumns(String table, List<String> columns, {String? schema}) Future<bool>
Determines if the given table has all of the specified columns.
hasIndex(String table, String index, {String? schema, String? type}) Future<bool>
Determines if the given table has a specific index. Optionally check by index type ('primary', 'unique', or specific driver type).
hasTable(String table, {String? schema}) Future<bool>
Determines if the given table exists.
hasView(String view, {String? schema}) Future<bool>
Determines if the given view exists.
listColumns(String table, {String? schema}) Future<List<SchemaColumn>>
Lists columns for table within an optional schema.
listDatabases() Future<List<String>>
Lists all databases/catalogs accessible to the current connection.
listForeignKeys(String table, {String? schema}) Future<List<SchemaForeignKey>>
Lists foreign keys for table within an optional schema.
listIndexes(String table, {String? schema}) Future<List<SchemaIndex>>
Lists indexes for table within an optional schema.
listSchemas() Future<List<SchemaNamespace>>
Lists the schemas/namespaces available in the connection.
listTables({String? schema}) Future<List<SchemaTable>>
Lists all user tables on the connection, optionally filtered by schema.
listViews({String? schema}) Future<List<SchemaView>>
Lists all views on the connection, optionally filtered by schema.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setCurrentSchema(String name) Future<void>
Sets the current schema/namespace for operations.
toString() String
A string representation of this object.
inherited
withoutForeignKeyConstraints<T>(Future<T> callback()) Future<T>
Executes a callback with foreign key constraints disabled. Automatically re-enables constraints after callback completes.

Operators

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