Testing
This commit is contained in:
BIN
database/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
database/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
database/__pycache__/flask_integration.cpython-312.pyc
Normal file
BIN
database/__pycache__/flask_integration.cpython-312.pyc
Normal file
Binary file not shown.
BIN
database/__pycache__/interface.cpython-312.pyc
Normal file
BIN
database/__pycache__/interface.cpython-312.pyc
Normal file
Binary file not shown.
BIN
database/__pycache__/sqlite_db.cpython-312.pyc
Normal file
BIN
database/__pycache__/sqlite_db.cpython-312.pyc
Normal file
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
import logging
|
||||
|
||||
from flask import current_app, g
|
||||
from flask import g
|
||||
|
||||
from .interface import DatabaseInterface
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Any, Dict, List, Optional
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
|
||||
class DatabaseInterface(ABC):
|
||||
|
||||
@@ -31,7 +31,7 @@ class SQLiteDatabase(DatabaseInterface):
|
||||
self._local.connection.execute("PRAGMA synchronous=NORMAL")
|
||||
self._local.connection.execute("PRAGMA cache_size=1000")
|
||||
self._local.connection.execute("PRAGMA temp_store=MEMORY")
|
||||
logger.debug(f"New SQLite connection created for thread")
|
||||
logger.debug("New SQLite connection created for thread")
|
||||
|
||||
return self._local.connection
|
||||
|
||||
@@ -61,14 +61,14 @@ class SQLiteDatabase(DatabaseInterface):
|
||||
try:
|
||||
cursor.execute(
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS users
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
username TEXT NOT NULL UNIQUE,
|
||||
email TEXT NOT NULL UNIQUE,
|
||||
password_hash TEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS users
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
username TEXT NOT NULL UNIQUE,
|
||||
email TEXT NOT NULL UNIQUE,
|
||||
password_hash TEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP )
|
||||
"""
|
||||
)
|
||||
conn.commit()
|
||||
logger.info("User table created/verified")
|
||||
|
||||
Reference in New Issue
Block a user