-- Create ohs_five_whys table for storing 5 Whys analysis lists
CREATE TABLE IF NOT EXISTS ohs_five_whys (
    id SERIAL PRIMARY KEY,
    whys jsonb NOT NULL,
    updatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    isDeleted BOOLEAN NOT NULL DEFAULT FALSE
);

ALTER TABLE ohs_root_causes
    ADD COLUMN IF NOT EXISTS five_whys_id INTEGER,
    DROP COLUMN IF EXISTS five_whys;
