CREATE TABLE IF NOT EXISTS http_function_tests (
    id SERIAL PRIMARY KEY,
    http_function_id INTEGER NOT NULL REFERENCES http_functions(id) ON DELETE CASCADE,
    name VARCHAR(255) NOT NULL,
    description TEXT,
    request_method VARCHAR(10) DEFAULT 'POST',
    request_headers JSONB DEFAULT '{}',
    request_body JSONB DEFAULT '{}',
    expected_status VARCHAR(50) NOT NULL DEFAULT 'SUCCESS',
    expected_output JSONB,
    created_at TIMESTAMP DEFAULT NOW(),
    updated_at TIMESTAMP DEFAULT NOW()
);

CREATE INDEX idx_http_function_tests_function_id ON http_function_tests(http_function_id);
