CREATE TABLE IF NOT EXISTS xbp_projects (
    project_id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
    project_name text NOT NULL,
    project_path text NOT NULL,
    version text,
    build_dir text,
    port integer,
    app_type text,
    branch text,
    target text,
    config_kind text,
    metadata jsonb NOT NULL DEFAULT '{}'::jsonb,
    created_at timestamptz NOT NULL DEFAULT now(),
    updated_at timestamptz NOT NULL DEFAULT now(),
    UNIQUE (project_path)
);

CREATE INDEX IF NOT EXISTS idx_xbp_projects_project_name ON xbp_projects (project_name);
CREATE INDEX IF NOT EXISTS idx_xbp_projects_updated_at ON xbp_projects (updated_at DESC);
