From 82641cc655dea5da8fa1efa111ad88bc71508aba Mon Sep 17 00:00:00 2001 From: mitsuha_s Date: Sun, 12 Jun 2022 22:42:41 +0000 Subject: [PATCH] delete the date field from the database schema --- database.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/database.py b/database.py index 040ee7b..9604624 100644 --- a/database.py +++ b/database.py @@ -129,11 +129,11 @@ class Database: def update_feed_items(self, feed_id: int, new_items: list[FeedItem]) -> None: """Replace last feed items with a list items that receive.""" for i in range(len(new_items)): - new_items[i] = [feed_id] + list(new_items[i].__dict__.values()) + new_items[i] = [feed_id] + list(new_items[i].__dict__.values())[:-1] self.cur.execute('DELETE FROM feeds_last_items WHERE feed_id = ?', [feed_id]) self.cur.executemany( - 'INSERT INTO feeds_last_items (feed_id, url, title, description, date) VALUES (?, ?, ?, ?, ?)', new_items) + 'INSERT INTO feeds_last_items (feed_id, url, title, description) VALUES (?, ?, ?, ?)', new_items) self.conn.commit() def __init_schema(self): @@ -157,7 +157,6 @@ class Database: ' url TEXT NOT NULL UNIQUE,' ' title TEXT,' ' description TEXT,' - ' date NUMERIC,' ' FOREIGN KEY(feed_id) REFERENCES feeds(id)' ')' )