createTable method

Future<bool> createTable(
  1. DatabaseSchema schema
)

Create a table if it doesn't exist

Implementation

Future<bool> createTable(DatabaseSchema schema) async {
  final sql = schema.toCreateTableSql(connection.databaseType);
  await connection.execute(sql);

  // Create indexes
  for (final indexSql in schema.toCreateIndexSql(connection.databaseType)) {
    await connection.execute(indexSql);
  }

  return true;
}