create method

Future<void> create(
  1. DatabaseSchemaEntity entity
)

Creates the given entity, which can be a table, a view, a trigger, an index or an OnCreateQuery.

Implementation

Future<void> create(DatabaseSchemaEntity entity) async {
  if (entity is OnCreateQuery) {
    final stmt = database.dialect.createCompiler();
    entity.definition.compileWith(stmt);
    await (await database.currentSession()).execute(
      stmt.statement.toStatementInfo(),
    );
  } else {
    await _run(CreateStatement.creatingElement(entity, ifNotExists: true));
  }
}