aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruser@node5.net <user@node5.net>2025-07-19 15:18:18 +0200
committeruser@node5.net <user@node5.net>2025-07-19 15:18:18 +0200
commitddcc24426fbc870d1017d1cf2cf7636936845d18 (patch)
tree4d814bdccc91641c5abd7e5c24f57f75da2c5cd1
parentf9b719c1cf6a8a92748d0977fce0f3704f74bca3 (diff)
SQLite fix create, remove config
-rw-r--r--create_db.sql2
-rw-r--r--src/blog_node5_net.py8
-rw-r--r--src/db_handler.py3
3 files changed, 2 insertions, 11 deletions
diff --git a/create_db.sql b/create_db.sql
index 638932c..ee0f968 100644
--- a/create_db.sql
+++ b/create_db.sql
@@ -1,5 +1,5 @@
CREATE TABLE comment (
- id serial PRIMARY KEY,
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
comment text NOT NULL, -- URL of the page the comment belongs to, this is the relation between the markdown and this database
page_url text,
visitor_url text, -- The website the user claims to be from, if they have their own self hosted website
diff --git a/src/blog_node5_net.py b/src/blog_node5_net.py
index 43c1d9c..d39fe7f 100644
--- a/src/blog_node5_net.py
+++ b/src/blog_node5_net.py
@@ -80,13 +80,7 @@ articles_by_url: typing.Dict[str, article.Article] = {}
# DB init
-try:
- with open(os.path.join('configs', 'database.yml'), 'r') as file:
- db_conf = yaml.safe_load(file.read())
- db: db_handler.DBHandler = db_handler.DBHandler(db_conf)
-except FileNotFoundError as ex:
- logger.warning("Database config - Not found, running without")
- db = None
+db: db_handler.DBHandler = db_handler.DBHandler()
# Telegram init
try:
diff --git a/src/db_handler.py b/src/db_handler.py
index 660e00a..673431d 100644
--- a/src/db_handler.py
+++ b/src/db_handler.py
@@ -7,10 +7,7 @@ import sqlite3
logger = logging.getLogger(__name__) # Set the logger name, to the name of the module
-@dataclass
class DBHandler:
- config: dict
-
def con_factory(self) -> sqlite3.Connection:
con = sqlite3.connect("blog.node5.net.db")
return con