Socket
Book a DemoInstallSign in
Socket

@tomkcey/pg-migrate

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tomkcey/pg-migrate

A small typed library for managing PostgreSQL migrations.

latest
Source
npmnpm
Version
0.10.0
Version published
Maintainers
1
Created
Source

GitHub Actions Workflow Status

How to use

Creating a migration file

For creating migration files you can use the CLI.

npx @tomkcey/pg-migrate create <migration_filename>

While database access is not required at this step, kkowing where to store those migrations is. In any case, here's all the environment variables you will need to use this program through the CLI.

PGUSER=<username>
PGPASSWORD=<password>
PGHOST=localhost
PGPORT=5432
PGDATABASE=<database>
PGSSL=<true/false>
MIGRATION_PATH=<absolute-path-to-migrations-dir>
MIGRATION_TABLE=<tablename>

Only MIGRATION_PATH is required if only using migration file creation through the CLI.

Running migrations up

import { Migrator, MigratorOptions } from "@tomkcey/pg-migrate";

const options: MigratorOptions = { ... }

const migrator = new Migrator(options, someLogger);

await migrator.up();

or npx @tomkcey/pg-migrate up

Running migrations down

import { Migrator, MigratorOptions } from "@tomkcey/pg-migrate";

const options: MigratorOptions = { ... }

const migrator = new Migrator(options, someLogger);

await migrator.down();

or npx @tomkcey/pg-migrate down

Roadmap

  • Create custom errors

Keywords

postgresql

FAQs

Package last updated on 16 Aug 2025

Did you know?

Socket

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.

Install

Related posts