1

im very new to flutter, and i just want to setup a SQLite database with multiple tables. my research below.

thanks in advance.

How to create multiple tables in a database in sqflite?

await db.execute('''
      create table $reminderTable (
        $columnReminderId integer primary key autoincrement,
        $columnReminderCarId integer not null,
        $columnReminderName text not null,
        $columnReminderNotifyMileage integer not null,
        $columnReminderEndMileage integer not null
       )''');
await db.execute('''
       create table $carTable (
        $columnCarId integer primary key autoincrement,
        $columnCarTitle text not null
       )''');

Unknown error calling sqlite3_step (10: disk I/O error) rs

tabby
  • 1,878
  • 1
  • 21
  • 39
  • 1
    You just linked a question (which yours is a duplicate of) and posted unformatted code from the correct answer. Where is *your* code and what is the problem you are having? – Herohtar Apr 29 '19 at 03:51

1 Answers1

1

You can just combine multiple db.execute calls for example

void _createDb(Database db, int newVersion) async {
    await db.execute(
        'CREATE TABLE $noteTable($colId INTEGER PRIMARY KEY AUTOINCREMENT, $colTitle TEXT, '
        '$colDescription TEXT, $colPriority INTEGER, $colDate TEXT)');

 await db.execute(
        'CREATE TABLE $noteTable($colId INTEGER PRIMARY KEY AUTOINCREMENT, $colTitle TEXT, '
        '$colDescription TEXT, $colPriority INTEGER, $colDate TEXT)');
  }
tabby
  • 1,878
  • 1
  • 21
  • 39
Anirban
  • 11
  • 1