huytrao123's picture
Upload 103 files
ced61cd verified
raw
history blame contribute delete
791 Bytes
import sqlite3
def create_auth_database():
"""Create authentication database if not exists"""
try:
conn = sqlite3.connect("./user_db/auth.db")
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT UNIQUE NOT NULL,
password_hash TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
""")
conn.commit()
conn.close()
print("✅ Authentication database created successfully")
except Exception as e:
print(f"❌ Error creating auth database: {e}")
# Chạy function này
create_auth_database()