import sqlite3
import os

DB_PATH = os.path.join(os.path.dirname(__file__), 'hiddencode.db')

def init_db():
    conn = sqlite3.connect(DB_PATH)
    c = conn.cursor()
    c.execute('''
    CREATE TABLE IF NOT EXISTS codes (
        id INTEGER PRIMARY KEY AUTOINCREMENT,
        sha TEXT UNIQUE,
        upload_code TEXT,
        download_code TEXT,
        created_at TEXT
    )
    ''')
    conn.commit()
    conn.close()

if __name__ == '__main__':
    init_db()
    print('Initialized database at', DB_PATH)
