CREATE TABLE IF NOT EXISTS osh.archive(
    scan_id SERIAL,
    offering_id VARCHAR(100),
    event_id VARCHAR(100) NOT NULL,
    is_managed_service BOOLEAN NOT NULL,
    component_list VARCHAR(100),
    datetime TIMESTAMP WITHOUT TIME ZONE DEFAULT (NOW() AT TIME ZONE 'utc') NOT NULL,
    owner VARCHAR(50) NOT NULL,
    results SERIAL,
    status VARCHAR (50) CONSTRAINT valid_status CHECK(status in ('PENDING', 'DELETED', 'COMPLETED', 'IN PROGRESS')),
    last_updated TIMESTAMP WITHOUT TIME ZONE DEFAULT (NOW() AT TIME ZONE 'utc') NOT NULL,
    PRIMARY KEY(scan_id),
    FOREIGN KEY (offering_id) REFERENCES osh.offerings(offering_id),
    FOREIGN KEY (results) REFERENCES osh.results(results_id)
);

INSERT INTO osh.archive (scan_id,offering_id,event_id,is_managed_service,component_list)
  VALUES(1,'product-id-1','event-id-1',true,' ');
