-- Drop existing tables if they exist
DROP TABLE IF EXISTS test_runs;

DROP TABLE IF EXISTS runs;

-- -- Drop existing enum if it exists
-- DROP TYPE IF EXISTS run_type;

-- -- Create an ENUM type for RunType
-- CREATE TYPE run_type AS ENUM ('start', 'end');

-- Create Runs table
CREATE TABLE
    runs (
        id SERIAL PRIMARY KEY,
        name TEXT NOT NULL,
        created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
    );

-- Create TestRuns table
CREATE TABLE
    test_runs (
        id SERIAL PRIMARY KEY,
        run_id INTEGER NOT NULL,
        test_name TEXT NOT NULL,
        path TEXT NOT NULL,
        duration bigint,
        success BOOLEAN,
        pending BOOLEAN default true,
        created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
        FOREIGN KEY (run_id) REFERENCES runs (id)
    );



    