
Research
Node.js Fixes AsyncLocalStorage Crash Bug That Could Take Down Production Servers
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.
@thesmart/alter
Advanced tools
Alter is a CLI tool for managing incremental changes to PostgreSQL.
Quick Start:
psql) (more)alter init from your project rootDatabase migrations are essential for:
Alter's migration system is designed around these principles:
This approach ensures that your database schema is:
Developer Workflow
Here's how you can work with Alter:
alter create to generate SQL for your dev database.alter up or psql to apply all pending migrations to
staging/production databases.# This will install the `alter` binary to the npm global bin path.
npm install -g @thesmart/alter
which alter && echo "Alter has been installed here: $(npm prefix -g)/bin/alter"
Alter depends on psql and pg_dump that ship with PostgreSQL. You should try to match versions
with your production DB.
MacOS
I prefer to use Postgres.app, which has an installer and tray app.
echo 'export PG_INSTALL="/Applications/Postgres.app/Contents/Versions/latest"' >> ~/.zshrc
echo 'export PATH="$PG_INSTALL/bin:$PATH"' >> ~/.zshrc
You can also use brew:
# For Apple Silicon (M1/M2/M3/M4 etc.)
brew install libpq
echo 'export LIBPQ_INSTALL="/opt/homebrew/opt/libpq/bin"' >> ~/.zshrc
echo 'export PATH="$LIBPQ_INSTALL/bin:$PATH"' >> ~/.zshrc
Debian/Ubuntu
sudo apt-get update
sudo apt-get install -y postgresql-client
Red Hat/CentOS/Fedora
# RHEL/CentOS 8 or later, x86
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo dnf install -y postgresql-client
Arch Linux
sudo pacman -S postgresql-libs
Configuration is set using
environment variables or (recommended) via
configuration file in the current working directory called .alter.env. A default file is created
for you by running alter init.
Here are the most important variables:
Here are some additional variables:
Alter provides multiple commands for schema management:
COMMANDS:
init Setup the project folder and database to work with Alter.
create DESCRIPTION Creates new migration with a UTC time-based id.
up Migrate the DB to the most recent version available.
up-one Migrate the DB up by 1.
up-to VERSION Migrate the DB to a specific VERSION (inclusive).
down Roll back that last applied version by 1.
down-to VERSION Roll back to a specific VERSION (inclusive).
history Print the database's change history.
history-json Print the database's change history in JSON.
pending Print all pending migrations, exit 0 if there are none or exit 70 if there any are pending.
pending-json Print all pending migrations in JSON, exit 0 if there are none or exit 70 if there any are pending.
OPTIONS:
-h
--help
print help
-v enable verbose mode
--version
print version
Setup the project folder and database to work with Alter. This is designed to work with both new and existing database. Here's what it does:
.alter.env using defaults (unless it already exists)./db directory (unless it already exists)./db/_baseline.sql (if it exists)_baseline.sql file exists, create one using the database's schemaalter_schema_history table (i.e. ALTER_TABLE) (if it doesn't already exist)$ alter init
Success 🎉
Database: my-database
History table: alter_schema_history
Baseline schema file: $USER/project/db/_baseline.sql
Create a new SQL migration.
$ alter create Add some column
Created new migration: db/2025-01-01-1159-add-some-column
Apply all available migrations.
$ alter up
OK 2025-01-01-1159-adds-user-authentication-feature/up.sql
OK 2025-01-03-1821-adds-phone-to-user-authentication/up.sql
OK 2025-03-18-0807-adds-tfa-to-user-authentication/up.sql
Migrate up to a specific version (inclusive).
$ alter up-to 2025-01-03
OK 2025-01-01-1159-adds-user-authentication-feature/up.sql
OK 2025-01-03-1821-adds-phone-to-user-authentication/up.sql
SKIP 2025-03-18-0807-adds-tfa-to-user-authentication/up.sql
Migrate up a single migration from the current version
$ alter up-by-one
OK 2025-01-01-1159-adds-user-authentication-feature/up.sql
SKIP 2025-01-03-1821-adds-phone-to-user-authentication/up.sql
SKIP 2025-03-18-0807-adds-tfa-to-user-authentication/up.sql
Roll back a single migration from the current version.
$ alter down
REV 2025-03-18-0807-adds-tfa-to-user-authentication/down.sql
Roll back migrations to a specific version (inclusive).
$ alter down-to 2025-01-03
REV 2025-03-18-0807-adds-tfa-to-user-authentication/down.sql
REV 2025-01-03-1821-adds-phone-to-user-authentication/down.sql
SKIP 2025-01-01-1159-adds-user-authentication-feature/down.sql
Print the history of previously applied migrations.
$ alter history
Wed Jan 01 2025 01:32:01.123
2025-01-01-1159-adds-user-authentication-feature
Fri Jan 03 2025 19:12:00.736
2025-01-03-1821-adds-phone-to-user-authentication
Thu Mar 21 2025 03:18:23.023
2025-03-18-0807-adds-tfa-to-user-authentication
Print all pending migrations. A pending migration is any local sql file not applied to the database. This will exit code 0 if there are no pending migrations or exit code 70 if there are any pending migrations needing to be run.
$ alter pending
2025-01-01-1159-adds-user-authentication-feature
2025-01-03-1821-adds-phone-to-user-authentication
2025-03-18-0807-adds-tfa-to-user-authentication
$ echo $?
70
$ alter up 1> /dev/null
$ alter pending
$ echo $?
0
Licensed under a custom Source Available License.
Here is a TL;DR summary:
FAQs
A CLI tool for managing incremental changes to PostgreSQL.
We found that @thesmart/alter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.

Research
/Security News
A malicious Chrome extension steals newly created MEXC API keys, exfiltrates them to Telegram, and enables full account takeover with trading and withdrawal rights.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.