delete the date field from the database schema

This commit is contained in:
mitsuha_s 2022-06-12 22:42:41 +00:00
parent 4e6cb3f28f
commit 82641cc655

View file

@ -129,11 +129,11 @@ class Database:
def update_feed_items(self, feed_id: int, new_items: list[FeedItem]) -> None: def update_feed_items(self, feed_id: int, new_items: list[FeedItem]) -> None:
"""Replace last feed items with a list items that receive.""" """Replace last feed items with a list items that receive."""
for i in range(len(new_items)): 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.execute('DELETE FROM feeds_last_items WHERE feed_id = ?', [feed_id])
self.cur.executemany( 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() self.conn.commit()
def __init_schema(self): def __init_schema(self):
@ -157,7 +157,6 @@ class Database:
' url TEXT NOT NULL UNIQUE,' ' url TEXT NOT NULL UNIQUE,'
' title TEXT,' ' title TEXT,'
' description TEXT,' ' description TEXT,'
' date NUMERIC,'
' FOREIGN KEY(feed_id) REFERENCES feeds(id)' ' FOREIGN KEY(feed_id) REFERENCES feeds(id)'
')' ')'
) )