add database schemas and general queries
This commit is contained in:
32
src/logic/db_schemas.py
Normal file
32
src/logic/db_schemas.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
KOMGRABBER_TABLE = """
|
||||||
|
CREATE TABLE IF NOT EXISTS komgrabber (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
name TEXT NOT NULL,
|
||||||
|
series_id TEXT NOT NULL,
|
||||||
|
status TEXT NOT NULL,
|
||||||
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
last_checked TIMESTAMP DEFAULT 0
|
||||||
|
);
|
||||||
|
"""
|
||||||
|
|
||||||
|
INSERT_KOMGRABBER = """
|
||||||
|
INSERT INTO komgrabber (name, series_id, status)
|
||||||
|
VALUES (?, ?, ?);
|
||||||
|
"""
|
||||||
|
SELECT_KOMGRABBER = """
|
||||||
|
SELECT * FROM komgrabber WHERE series_id = ?;
|
||||||
|
"""
|
||||||
|
UPDATE_KOMGRABBER = """
|
||||||
|
UPDATE komgrabber
|
||||||
|
SET name = ?, status = ?, updated_at = CURRENT_TIMESTAMP
|
||||||
|
WHERE series_id = ?;
|
||||||
|
"""
|
||||||
|
LASTCHECKED_KOMGRABBER = """
|
||||||
|
UPDATE komgrabber
|
||||||
|
SET last_checked = CURRENT_TIMESTAMP
|
||||||
|
WHERE series_id = ?;
|
||||||
|
"""
|
||||||
|
GET_LASTCHECKED_KOMGRABBER = """
|
||||||
|
SELECT last_checked FROM komgrabber WHERE series_id = ?;
|
||||||
|
"""
|
||||||
Reference in New Issue
Block a user