CREATE TABLE key_categories ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, type TEXT NOT NULL, tags TEXT, metadata TEXT, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL );
CREATE TABLE sqlite_sequence(name,seq);
CREATE TABLE api_keys ( id INTEGER PRIMARY KEY AUTOINCREMENT, value TEXT NOT NULL, category_id INTEGER NOT NULL, status TEXT DEFAULT 'active' NOT NULL, usage_count INTEGER DEFAULT 0 NOT NULL, last_used DATETIME, metadata TEXT, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, FOREIGN KEY (category_id) REFERENCES key_categories (id) ON DELETE CASCADE );
