createTable method

void createTable(
  1. String table,
  2. List<String> columns, {
  3. List<String> constraints = const [],
  4. List<String> options = const [],
})

Implementation

void createTable(String table, List<String> columns, {List<String> constraints = const [], List<String> options = const []}) {
  SpaceBuffer buf = SpaceBuffer();
  buf << "CREATE TABLE IF NOT EXISTS";
  buf << table;
  buf << "(";
  buf << columns.join(", ");
  if (constraints.isNotEmpty) {
    buf << ", ";
    buf << constraints.join(", ");
  }
  buf << ")";
  if (options.isNotEmpty) {
    buf << options.join(", ");
  }
  execute(buf.toString());
}