prisma-tunneled-deploy
v0.1.5
Published
Deploy Prisma Migrations to a remote database through SSH tunneling
Downloads
10
Readme
prisma-tunneled-deploy
Apply Prisma Databse migrations through an SSH tunnel
Installation
pnpm add -D prisma-tunneled-deploy
Usage
Deploy migrations through a script
Create a new file where you source all the required inputs.
// ./scripts/deploy.mjs import { deployMigrations } from 'prisma-tunneled-deploy'; import { readFileSync } from 'fs'; const dbCredentials = { host: 'localhost', port: 5432, username: 'postgres', password: 'postgres', }; await deployMigrations( { ...dbCredentials, url: `postgresql://${dbCredentials.username}:${dbCredentials.password}@${dbCredentials.host}:${dbCredentials.port}`, }, { // details of the bastion host used for SSH tunneling host: '192.168.100.100', privateKey: readFileSync('/path/to/my/key').toString('utf-8'), username: 'ubuntu', } );
Set up a script in your
package.json
file that will execute it:{ "scripts": { "migrate:deploy": "./scripts/deploy.mjs" } }
Make sure the file is executable, and run the script:
pnpm migrate:deploy