Added default value to db

This commit is contained in:
andrei 2021-11-02 22:24:59 -04:00
parent 501c937490
commit 6bbb809a28
1 changed files with 15 additions and 1 deletions

View File

@ -17,7 +17,7 @@ class DBHelper {
Future<Database> _createDatabase() async {
Database database =
await openDatabase(join(await getDatabasesPath(), 'mydb.db'),
await openDatabase(join(await getDatabasesPath(), 'lists.db'),
onCreate: (Database db, int version) {
db.execute("""
CREATE TABLE List(
@ -34,6 +34,20 @@ class DBHelper {
list_id INTEGER
)
""");
db.execute("""
INSERT INTO List(id, list_name, is_template)
VALUES
(0, 'test list', 0),
(1, 'test template', 1)
""");
db.execute("""
INSERT INTO CHECK(check_text, value, list_id)
VALUES
('test check', 1, 0),
('test uncheck', 0, 0),
('test check', 1, 1),
('test uncheck', 0, 1)
""");
}, version: 1);
return database;
}