DbState
Menu

Git-native database state management

Database state belongs in the repository.

DbState compares PostgreSQL database state with the desired state defined in Git. It helps teams capture database objects as files, review schema and reference-data differences, and prepare release artifacts without directly applying changes.

Database execution stays outside DbState.

Operating model

One repository. Two directions. Explicit state.

The Git repository is the source of truth for desired database state. DbState connects that repository to a target PostgreSQL database through explicit capture, comparison, and review workflows.

  1. 01

    Database inspection

    DbState reads PostgreSQL metadata and selected reference-data rows.

  2. 02

    Repository capture

    Explicit Database-to-Repository workflows write selected database objects or reference data into repository-managed files.

  3. 03

    State comparison

    Repository-to-Database workflows compare desired state against the target database.

  4. 04

    Release preparation

    Supported differences may be selected in a Release Plan and prepared as review-only artifacts.

  5. 05

    Execution boundary

    DbState does not execute generated SQL or directly mutate PostgreSQL during release workflows.

Product model

PostgreSQL Database

metadata and selected reference-data rows

DbState

capture, compare, diff, and plan

Git Repository Desired State

object files and reference-data YAML

Release Plan

selected supported candidates

Review-only Release Artifacts

database execution occurs outside DbState

PostgreSQL Database connects both directions to DbState. DbState connects both directions to Git Repository Desired State. The repository then leads to a Release Plan and review-only release artifacts.

Workflow model

Four workflows, each with an explicit direction.

DbState separates schema from reference data and separates repository file writes from read-only database comparison. The direction is part of the workflow, not an implicit side effect.

State type

Schema

Database to Repository

Schema Compare: Database to Repository

repository writes only
Direction
Database to Repository
Source
PostgreSQL database
Target
Git repository

Purpose

Inspect supported database objects and write selected objects into durable repository files.

Output

Repository-managed object files

Safety boundary

Repository writes only. No PostgreSQL mutation. No automatic Git operations.

Repository to Database

Schema Compare: Repository to Database

read-only database compare
Direction
Repository to Database
Source
Git repository desired state
Target
PostgreSQL database

Purpose

Compare repository-managed objects with a target database, inspect differences, build a Release Plan, and prepare supported review-only artifacts.

Output

Comparison results, Object Diff, Release Plan, and review-only artifacts

Safety boundary

Read-only database comparison. No direct apply. No generated SQL execution.

State type

Reference data

Database to Repository

Reference Data Compare: Database to Repository

explicit repository writes
Direction
Database to Repository
Source
PostgreSQL database
Target
Git repository

Purpose

Select reference-data tables, define row identity and comparison rules, preview YAML, and write approved repository files.

Output

Reference-data configuration and YAML files

Safety boundary

Explicit repository writes only. No PostgreSQL mutation. No automatic Git operations.

Repository to Database

Reference Data Compare: Repository to Database

read-only row compare
Direction
Repository to Database
Source
Repository-managed YAML
Target
PostgreSQL database

Purpose

Compare repository-managed rows with PostgreSQL and inspect row-level state.

Output

Data Diff

Safety boundary

Read-only comparison. No automatic INSERT, UPDATE, DELETE, MERGE, or direct data apply in the current Private Beta.

Schema state

Database objects become durable repository files.

DbState stores one durable database object per repository file under controlled folders. The repository becomes the place where database structure can be reviewed beside application code.

Representative repository structure

database/
  objects/
    schemas/
    extensions/
    enums/
    sequences/
    tables/
    indexes/
    views/
    materialized-views/
    constraints/
    functions/
    triggers/
    grants/
    rls-policies/
  • Smaller Git diffs
  • Easier pull-request review
  • Clear object identity
  • Better comparison with target databases
  • More explicit release candidate selection

DbState does not automatically commit these files. Git history remains under user control.

DbState Schema Compare results grid showing the public.actor table as repoDifferent and several PostgreSQL tables as databaseOnly.

Schema Compare

Compare repository desired state with a target PostgreSQL database and identify different, database-only, repository-only, and in-sync objects.

Open full-size Schema Compare screenshot

Object Diff

Inspect the object, not just the status.

Comparison state alone is not enough. Object Diff exposes the repository and database definitions for a selected object so reviewers can understand the difference before deciding whether it belongs in a Release Plan or requires manual review.

Review target

The screenshot shows a real public.actor table difference with a repository-only nullable dbstate_demo_note column. DbState does not automatically resolve the difference.

DbState Object Diff screen comparing repository and database DDL for public.actor, with the repository-only dbstate_demo_note text column visible.

Object Diff

Inspect repository and database definitions for a selected object before deciding how to handle the difference.

Open full-size Object Diff screenshot

Reference data

Reference data belongs in Git too.

Slowly changing operational rows often carry application meaning but are poorly represented in schema-only workflows. DbState treats selected tables as repository-managed reference data when users explicitly configure them.

Common candidates

  • Countries
  • Statuses
  • Categories
  • Fee matrices
  • Policy values
  • Configuration rows
  • Lookup tables

Explicit comparison rules

  • Users choose which tables are reference data
  • Key columns identify rows
  • Versioned columns are compared
  • Ignored columns are excluded from comparison
  • Masked columns remain protected

Concise configuration example

version: 1
tables:
  - schema: public
    name: country
    keyColumns:
      - country_id
    ignoredColumns:
      - last_update
    maskedColumns: []

This example identifies public.country by country_id and excludes last_update from comparison.

Data Diff

Review row state without pretending every difference is safe to automate.

Repository-to-Database reference-data comparison is read-only in the current Private Beta. DbState shows row state so reviewers can decide how to handle differences outside DbState.

Current row classifications

  • Repository only
  • Database only
  • Different
  • In sync

Reference-data safety boundary

  • Repository-to-Database reference-data comparison is read-only
  • No automatic INSERT generation in the current Private Beta
  • No automatic UPDATE generation in the current Private Beta
  • No DELETE generation
  • No MERGE generation
  • No direct data apply

Database-only rows may still be referenced by foreign keys or carry historical meaning, so DbState leaves removal decisions for manual review.

DbState Data Diff screen for public.country showing row counts for similar, different, repositoryOnly, and databaseOnly states.

Reference Data Diff

Review repository-only, database-only, different, and in-sync reference-data rows.

Open full-size Reference Data Diff screenshot

Release Plans

Prepare the handoff without taking over execution.

Repository-to-Database schema comparison can lead into a Release Plan. Reviewers select supported candidates, inspect the handoff, and keep database execution in their normal release process outside DbState.

  1. 01Compare repository desired state with PostgreSQL
  2. 02Inspect Object Diff
  3. 03Select supported release candidates
  4. 04Build a Release Plan
  5. 05Prepare supported review-only artifacts
  6. 06Review and execute approved SQL outside DbState
DbState Release Plan screen showing selected schema release candidates, manual review labels, and review-only candidate explanations.

Release Plan

Select supported release candidates and review the planned handoff before any database execution occurs outside DbState.

Open full-size Release Plan screenshot

PostgreSQL coverage

PostgreSQL coverage beyond tables and columns.

DbState Private Beta understands a meaningful set of PostgreSQL object types needed for application and database engineering workflows.

PostgreSQLPrivate Beta

Structure

  • Schemas
  • Extensions
  • Enums
  • Sequences
  • Tables
  • Indexes

Query and derived objects

  • Views
  • Materialized views

Constraints

  • Primary keys
  • Unique constraints
  • Foreign keys
  • Check constraints

Programmability

  • Regular functions
  • Triggers

Security

  • Grants
  • Row-level security policiesRLS policies

Data

  • Reference data

Current boundaries

Deliberately local and review-first.

Current Private Beta boundaries are product decisions. DbState is focused on local PostgreSQL review workflows where the user remains in control of Git history and database execution.

Local workflow

Private Beta runs as a local Windows developer workflow.

Git remains user-controlled

DbState does not automatically add, commit, push, pull, fetch, or tag.

Database execution remains external

Generated artifacts are reviewed and executed through the team's normal database release process outside DbState.

Collaboration is future scope

Hosted workflows, shared workspaces, approval systems, and server-based collaboration are not part of the current Private Beta.

PostgreSQL first

The current product focuses on PostgreSQL. The database-state model may expand to additional relational database engines over time.

Private Beta

Evaluate DbState with a real PostgreSQL workflow.

The current Private Beta is intended for developers, database engineers, and technical teams actively managing PostgreSQL schema or reference-data changes through Git.

PostgreSQLWindowsLocal workflowGit repository requiredReview-only release artifactsAccess by request