import os, sqlite3

// Add the verification token function to the existing db module
db_path = os.path.join(os.path.dirname(__file__), '..', 'database.sqlite')
db = sqlite3.connect(db_path)

// Check if table already exists
cur = db.execute("SELECT NAME FROM sqlite_master WHERE type='table' AND name='verification_tokens'")
if not cur.fetchone():
    db.execute('''CREATE TABLE IF NOT EXISTS verification_tokens (
        id TEXT PRIMARY KEY,
        email TEXT NOT NULL,
        token TEXT NOT NULL UNIQUE,
        purpose TEXT NOT NULL,
        expires_at DATETIME NOT NULL,
        used INTEGER DEFAULT 0,
        created_at DATETIME DEFAULT CURRENT_TIMESTAMP
    )''')
    db.commit()
    print('Verification tokens table created')
else:
    print('Verification tokens table already exists')
db.close()

print('Ready to create the TypeScript files...')