Skip to main content

db apply

Apply the planned schema changes to the local cloned database.

Usage​

postkit db apply [-f]

Options​

OptionDescription
-fSkip confirmation prompts
-v, --verboseEnable verbose output
--dry-runShow what would be done without making changes
--jsonOutput as JSON

What It Does​

  1. Validates schema fingerprint (ensures schema files haven't changed since plan)
  2. Displays the planned changes
  3. Tests local database connection
  4. Applies infrastructure SQL from db/schema/infra/
  5. Wraps the plan SQL and creates a dbmate migration file (staged in .postkit/db/session/)
  6. Runs dbmate migrate on the local database
  7. Applies seed data from db/schema/seeds/

Resume support: If seeds fail, re-running postkit db apply resumes from where it left off.

Requirements​

  • An active session must exist
  • A plan must exist (run db plan first)
  • plan - Generate schema diff
  • commit - Commit for deployment