mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-23 03:11:01 +01:00
- refactored backend for general data endpoints - removed ID based files - overhauled quality profile creation - qualities, tags, scores, langauges, upgrades have all been added
30 lines
714 B
Python
30 lines
714 B
Python
# db.py
|
|
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()
|