CREATE TABLE IF NOT EXISTS tracked_plan (
    plan_id UUID PRIMARY KEY,
    spacecraft_id VARCHAR(255) NOT NULL,
    start_time TIMESTAMP NOT NULL,
    end_time TIMESTAMP NOT NULL,
    kpp_id VARCHAR(255) NOT NULL,
    process_instance_key BIGINT,
    created_at TIMESTAMP NOT NULL,
    confirmed_at TIMESTAMP,
    status VARCHAR(64) NOT NULL
);

CREATE INDEX IF NOT EXISTS idx_tracked_plan_spacecraft_id ON tracked_plan(spacecraft_id);
CREATE INDEX IF NOT EXISTS idx_tracked_plan_status ON tracked_plan(status);
