Files
profilarr/backend/app/db.py
Sam Chau 19c6be2f21 feature: save external app connections (#8)
- SQLite DB added
- Store external app connections
- Authentication, tags, type, name implemented
2025-02-05 16:09:59 +10:30

29 lines
706 B
Python

import sqlite3
import os
DB_PATH = '/app/data/profilarr.db'
def get_db():
conn = sqlite3.connect(DB_PATH)
conn.row_factory = sqlite3.Row
return conn
def init_db():
with get_db() as conn:
conn.execute('''
CREATE TABLE IF NOT EXISTS arr_config (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT UNIQUE NOT NULL,
type TEXT NOT NULL,
tags TEXT,
profilarr_server TEXT NOT NULL,
arr_server TEXT NOT NULL,
api_key TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
''')
conn.commit()