create method
Implementation
TableDefinition create(
String tableName,
Function(Schema) callback, [
bool ifNotExists = false,
]) {
Future<void> createFunction() async {
// Reset here rather than at build time: the schema builder is shared
// across every create()/alterColumn() call on this migration, and the
// callback only runs when the returned TableDefinition is awaited.
_schemaBuilder.reset();
_schemaBuilder.setTableName(tableName);
callback(_schemaBuilder);
final statements = _requireAdapter.renderCreateTable(
_schemaBuilder.toBlueprint(),
ifNotExists: ifNotExists,
);
await _executeStatements(statements);
}
return TableDefinition(
tableName,
createFunction,
connection: _connection,
adapter: _adapter,
);
}