feat(db): add additive GitLab cloud checkout metadata

TE
2mo ago
+28282-1

What & why

Make the GitLab database prerequisite self-contained: matching Drizzle declarations, generated SQL, snapshots, journal entries and co-located tests land together. Add gitlab integration/automation enum values and three metadata tables for organization projects, environment projects and workspace checkouts. A second generated migration adds three covering foreign-key indexes for organization/connection cleanup. Existing definitions and rows are retained; no backfill or existing-row rewrite is introduced.

Land this prerequisite before enabling the GitLab application paths in #8235. The fixture PostgreSQL driver is a DB development dependency; the tests import no application, host or client code. Roll back application behavior first and retain the additive metadata and enum values.

One commit based on upstream 2dda82c314606aaa099b8626150c61450d66b629. Final candidate: 6b328fcf38f5e3b8760cf5b06a0336ca60385bc8. Related review: tracking issue #8241.

The one-commit combined source on review/verified-composition-20261007 (ef1ac91f) integrates all seven proposals for reproduction without another PR. Shared graph evidence applies to that composition; focused proposal checks are recorded separately.

How I tested it

Drizzle check passed, and generation from the final declarations reported no further schema changes. A disposable PostgreSQL 18 database applied the complete 146-migration chain and verified all six foreign keys and three new covering indexes. The additive migration measured 49.27 ms alongside nine parent-read/child-write operations under five-second lock and one-minute statement timeouts.

All eight schema cases passed. The schema plus four related tRPC fixture files passed 42 tests and 226 assertions with zero skips/failures, then repeated with the same result and clean fixture state. They cover typed upsert, text IDs, defaults, case/time zones, connection-scoped uniqueness, missing-parent refusal and cascades. Final focused proposal checks: Standalone schema declarations/typechecks and Drizzle check/regeneration passed. Eight schema cases passed against real PostgreSQL 18; combined schema plus canonical tRPC fixtures passed 42 cases/226 assertions with zero skips, repeated successfully. The complete 146-migration chain and bounded concurrent read/write rehearsal passed..

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (final candidate scope/results above)
  • "Allow edits from maintainers" is checked on fork PRs

Summary by CodeRabbit

  • New Features
    • Added GitLab as an automation trigger and integration provider.
    • Added support for storing GitLab project connections, environment projects, and workspace checkouts.
    • Added GitLab configuration options for integration setup.