From 5f41716b63aac904fb2a3e74a6c0cfa8b33a728c Mon Sep 17 00:00:00 2001 From: Mike Young Date: Sun, 17 Nov 2019 09:53:00 -0500 Subject: [PATCH] Added Nulls, and default 0's --- app/lib/storage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/storage.py b/app/lib/storage.py index a8fb782..49a87ab 100755 --- a/app/lib/storage.py +++ b/app/lib/storage.py @@ -33,7 +33,7 @@ class Storage(): """Create table structure""" q_check = "SELECT * FROM books" q_create = '''CREATE TABLE books(title text, author text, - categories text, cover blob, pages int, progress int, + categories text null, cover blob null, pages int null, progress int null, file_name text)''' try: self.cursor.execute(q_check) @@ -46,7 +46,7 @@ class Storage(): :returns: True if succeeds False if not """ q_x = '''SELECT title FROM books WHERE EXISTS(SELECT * from books WHERE `title` = ?)''' - q = '''INSERT INTO books (title, author, cover, file_name) values (?, ?, ?, ?)''' + q = '''INSERT INTO books (title, author, cover, progress, file_name, pages) values (?, ?, ?, 0, ?, 0)''' try: try: cover_image = book[2].data except: cover_image = book[2]