ALTER TABLE api_keys RENAME TO app_api_keys;

CREATE TABLE IF NOT EXISTS provider_configs (
    id INT AUTO_INCREMENT PRIMARY KEY,
    provider ENUM('vtpass', 'buypower', 'paystack') NOT NULL,
    config_key VARCHAR(50) NOT NULL,
    config_value TEXT NOT NULL,
    is_encrypted TINYINT(1) NOT NULL DEFAULT 0,
    active TINYINT(1) NOT NULL DEFAULT 1,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    created_by INT NOT NULL,
    UNIQUE KEY provider_key_unique (provider, config_key),
    FOREIGN KEY (created_by) REFERENCES users(id)
);
