Task 02 establishes the code-host portability pattern.
Risks
GitLab stores numeric switches beside boolean columns. Preserve the current model type of each column.
Parallelism
sequential
Inputs
apps/backend/internal/gitlab/store.go
Existing GitLab store tests for each listed concept.
Results
Adapted GitLab schema DDL and idempotent migrations to the active driver,
including PostgreSQL timestamp and boolean forms.
Reused shared schema probes and rebound GitLab settings, task-MR, watch,
reservation, reset, cleanup, mention-scope, and automation queries.
Preserved integer-backed last_ok and draft columns with explicit CASE
conversion while using boolean literals for PostgreSQL boolean columns.
Kept the SQLite-only MR-watch table rebuild on SQLite and added a
transaction-safe PostgreSQL migration for legacy two-column MR-watch unique
constraints.
Added a PostgreSQL legacy-schema upgrade test that calls EnsureMRWatch for
two branches on one session and repository.
Verification: KANDEV_TEST_POSTGRES_DSN=<local test DSN> go test -race ./internal/gitlab -run 'TestPostgresStore|TestMigrateMRWatchUniqueKey_PostgresLegacy' -v passed.
Verification: KANDEV_TEST_POSTGRES_DSN=<local test DSN> go test -race ./internal/gitlab passed.