
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
postgresql-migrate
Advanced tools
Simple CLI migration tool for PostgreSQL and Node.js with migration files written in raw SQL. TypeScript types files for all tables and columns in the database are automatically created.
Simple CLI migration tool for PostgreSQL and Node.js with migration files written in raw SQL. TypeScript types files for all tables and columns in the database are automatically created.
Create a JSON config file, e.g. config.json with the connection to the database. You can either store connection information directly as a string but it is recommended to use environment variables from your .env file. To do so, simple add env:VARIABLE_NAME as the value and the package will automatiaclly replace it with the value of the environment variable.
Note: the db user used for the migration must have the required privileges to CREATE TABLES AND DROP TABLES.
npm install postgresql-migrate
Run the following command with the path to the directory that will contain the directory with the SQL migration files as well as the config.json.
postgresql-migrate setup -d "path-to-migration-dir"
Open the newly created config.json and specify your settings. For the migration to work, the connection (database) part is required. All other settings are optional.
{
"connection": {
"host": "env:DB_HOST",
"port": "env:DB_PORT",
"user": "env:DB_USER",
"password": "env:DB_PASSWORD",
"database": "env:DB_NAME"
}
}
Now you can run various CLI commands, such as creating migration files or applying up or down migration steps. You just need to reference the config.json.
postgresql-migrate -d "path-to-migration-dir" create "name-of-migration-file"
For a successful migration, you should provide both up and down scripts and these must be placed after the /* UP */ comment for the [UP] migration script and after /* DOWN */ for the [DOWN] migration script.
/* UP */
CREATE TABLE "Users" (
id SERIAL PRIMARY KEY,
username VARCHAR NOT NULL,
email VARCHAR NOT NULL
);
/* DOWN */
DROP TABLE IF EXISTS "Users" CASCADE;
postgresql-migrate -d "path-to-migration-dir" up
package.jsonTo simplify running commands, it is recommended to add the following command to your package.json.
{
"scripts": {
"migrate": "postgresql-migrate -d 'path-to-migration-dir'"
}
}
Now you can use any command simply with
npm run migrate [up|down|create|redo|reset|setup|status]
FAQs
Simple CLI migration tool for PostgreSQL and Node.js with migration files written in raw SQL. TypeScript types files for all tables and columns in the database are automatically created.
The npm package postgresql-migrate receives a total of 0 weekly downloads. As such, postgresql-migrate popularity was classified as not popular.
We found that postgresql-migrate demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.