Added default value to db
This commit is contained in:
parent
501c937490
commit
6bbb809a28
|
|
@ -17,7 +17,7 @@ class DBHelper {
|
||||||
|
|
||||||
Future<Database> _createDatabase() async {
|
Future<Database> _createDatabase() async {
|
||||||
Database database =
|
Database database =
|
||||||
await openDatabase(join(await getDatabasesPath(), 'mydb.db'),
|
await openDatabase(join(await getDatabasesPath(), 'lists.db'),
|
||||||
onCreate: (Database db, int version) {
|
onCreate: (Database db, int version) {
|
||||||
db.execute("""
|
db.execute("""
|
||||||
CREATE TABLE List(
|
CREATE TABLE List(
|
||||||
|
|
@ -34,6 +34,20 @@ class DBHelper {
|
||||||
list_id INTEGER
|
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);
|
}, version: 1);
|
||||||
return database;
|
return database;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue