create function

Future create(
  1. Connection conn,
  2. double version,
  3. Map<String, Map<String, SqlType>> tables,
  4. Map<String, IndexInfo> indexes,
  5. Map<String, RuleInfo> rules,
)

Creates the tables specified in version.

Implementation

Future create(Connection conn,
    double version, Map<String, Map<String, SqlType>> tables,
    Map<String, IndexInfo> indexes, Map<String, RuleInfo> rules) async {
  final Set<String> tblsGened = HashSet<String>();
  final List<_DeferredRef> refsDeferred = [];

  for (final otype in tables.keys)
    await _createTable(conn, otype, tables[otype]!, tblsGened, refsDeferred);
  for (final defRef in refsDeferred)
    await defRef.create(conn);

  for (final name in indexes.keys)
    await _createIndex(conn, name, indexes[name]!);
  for (final name in rules.keys)
    await _createRule(conn, name, rules[name]!);
}