Registry / database / postgres-schema-updater

postgres-schema-updater

JSON →
library1.1.5jsnpmunverified

A CLI tool for comparing and applying PostgreSQL schema changes from SQL source files. Version 1.1.5. It reads a source directory of SQL files, concatenates them into a temporary file, and compares against a target file or database. Designed for development workflows with manual confirmation before executing changes. Differentiates from migration tools by focusing on schema comparison rather than versioned migrations. Low release cadence.

npm install postgres-schema-updater
INSTALL
IMPORT
SIG · POSTGRES-SCHEMA-UP
P
postgres-schema-updater
databasejavascriptv1.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

stage
import { stage } from 'postgres-schema-updater'
const stage = require('postgres-schema-updater').stage
ESM-only, the package does not export a default.
bin/stage.js
npx postgres-schema-updater/bin/stage.js
require('postgres-schema-updater')
Primary use is CLI via bin script, not programmatic import.
StageConfig
import type { StageConfig } from 'postgres-schema-updater'
TypeScript types are included, use type import.

Shows how to configure environment variables and run the stage CLI command with verbose flag and connection string.

#!/usr/bin/env bash # Set up environment variables export CONNECTION_STRING='postgres://postgres:password@localhost:5432/mydb' export SOURCE='sql/src/**/*.sql' export TMP_FILE='sql/development.sql' export COMPARE_FILE='sql/staging.sql' # Run the stage command npx postgres-schema-updater/bin/stage.js -v -c "$CONNECTION_STRING" # Output: Prompts for confirmation before applying changes. # Note: The tool will concatenate source files, compare, and show diff.
Debug
Known issues
gotchaThe tool prompts for confirmation before applying changes; cannot be skipped programmatically.
fix
Use a PTY or expect script to automate, or modify source to accept a --yes flag.
affects: >=1.0
breakingConfiguration via .env file is optional but source and TMP_FILE must be set either via env or .env.
fix
Ensure environment variables or .env file defines CONNECTION_STRING, SOURCE, TMP_FILE, COMPARE_FILE.
affects: >=1.0
deprecatedThe binary is named `stage.js` but is not placed in PATH; users must reference full path.
fix
Use npx postgres-schema-updater/bin/stage.js or add to scripts in package.json.
affects: >=1.0
Errors
Common errors & fixes
Error: Cannot find module 'postgres-schema-updater/bin/stage.js'
Running without npx or without installing the package globally.
fix
Run with npx: npx postgres-schema-updater/bin/stage.js
CONNECTION_STRING is not set
Missing environment variable or .env file not loaded.
fix
Set CONNECTION_STRING environment variable or create .env file with CONNECTION_STRING=postgres://...
SOURCE is not set
Environment variable SOURCE or TMP_FILE missing.
fix
Define SOURCE and TMP_FILE environment variables or in .env file.
Upgrade
Version history
1.1.5latest on npm
Audit
Dependencies
dotenvoptionalloads .env configuration for connection string and paths
Agent activity
9 hits · last 30 days
node
8
Resources
postgres-schema-updater — npm install postgres-schema-updater · libregistry