add add_user method

This commit is contained in:
mitsuha_s 2022-05-21 10:48:33 +00:00
parent 60a7648ce4
commit 8b04adef2b

View file

@ -6,7 +6,11 @@ class Database():
self.cur.execute('CREATE TABLE IF NOT EXISTS users (id INTEGER, telegram_id NUMERIC, PRIMARY KEY(id))') self.cur.execute('CREATE TABLE IF NOT EXISTS users (id INTEGER, telegram_id NUMERIC, PRIMARY KEY(id))')
self.cur.execute('CREATE TABLE IF NOT EXISTS feeds (id INTEGER, link TEXT, PRIMARY KEY(id))') self.cur.execute('CREATE TABLE IF NOT EXISTS feeds (id INTEGER, link TEXT, PRIMARY KEY(id))')
self.cur.execute('CREATE TABLE IF NOT EXISTS subscribes (user_id INTEGER, feed_id INTEGER, FOREIGN KEY(user_id) REFERENCES users(id), FOREIGN KEY(feed_id) REFERENCES feeds(id))') self.cur.execute('CREATE TABLE IF NOT EXISTS subscribes (user_id INTEGER, feed_id INTEGER, FOREIGN KEY(user_id) REFERENCES users(id), FOREIGN KEY(feed_id) REFERENCES feeds(id))')
self.cur.execute('CREATE TABLE IF NOT EXISTS feeds_last_items (feed_id INTEGER, link TEXT, title TEXT, description TEXT, date NUMERIC, FOREIGN KEY(feed_id) REFERENCES feeds(id))') self.cur.execute('CREATE TABLE IF NOT EXISTS feeds_last_items (feed_id INTEGER, link TEXT, title TEXT, description TEXT, date NUMERIC, FOREIGN KEY(feed_id) REFERENCES feeds(id))')
def add_user(self, telegram_id):
self.cur.execute('INSERT INTO users (telegram_id) VALUES (:telegram_id)', {'telegram_id': telegram_id})
self.conn.commit()
def add_rss_feed(): def add_rss_feed():
pass pass
@ -25,4 +29,3 @@ class Database():
def storing_feed_content(): def storing_feed_content():
pass pass