create method

Future<void> create()

Implementation

Future<void> create() async {
  String str = 'CREATE TABLE IF NOT EXISTS $name (';

  int count = 0;
  for (var column in columns) {
    String columnNullable = column.isNullable ? 'NULL' : 'NOT NULL';

    str +=
        '${column.name} ${column.type.toString().split('.').last.toUpperCase()} $columnNullable';

    if (count + 1 != columns.length) str += ',\n';
    count++;
  }

  str += ')';

  return await Database.database.execute(str);
}