Worktree Refresh Database Schema (persistence/worktree-refresh-schema.ts)

gbrain · src/core/persistence/worktree-refresh-schema.ts · typescript · MIT
database, dev-tools

Defines the database schema and DDL constants for tracking coordinated fast-forward refreshes of managed git worktrees. Reuse when building worktree state persistence layers.

// Source: https://github.com/garrytan/gbrain | License: MIT | Copyright 2026 Garry Tan
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * `gbrain sources refresh` storage (F0): one row per coordinated fast-forward
 * of a managed worktree. The canonical DDL copy is used by the schema
 * migration and, through scripts/build-schema.ts FRAGMENTS, by fresh installs.
 * The partial unique index makes "one active refresh per worktree" a database
 * fact; its unique violation maps to `refresh_in_progress`.
 *
 * The predicate constants live here, beside the DDL and free of imports, so
 * journal.ts and effect-journal.ts can embed them without an import cycle.
 */

export const WORKTREE_REFRESH_SCHEMA_SQL = `
CREATE TABLE IF NOT EXISTS persistence_worktree_refreshes (
  id uu

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key