How to create multiple tables in a database in sqflite?

后端 未结 6 1890
礼貌的吻别
礼貌的吻别 2021-01-11 11:51

Im building and app with flutter that uses SQLite database. I have created first table using this piece of code:

 void _createDb(Database db, int newVersion)         


        
6条回答
  •  被撕碎了的回忆
    2021-01-11 12:12

    You can just combine multiple db.execute calls for exampple

    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
           )''');

提交回复
热议问题