0.1.2-alpha • Published 2 years ago
cbpgm v0.1.2-alpha
Postgres Migrate
Screw DSLs. Write migrations using plain SQL.
Example
migrations/
1_up_my_first_migration.sql
1_down_my_first_migration.sql
2_up_add_users.sql
2_down_add_users.sql
3_up_add_posts.sql
3_down_add_posts.sql
cbpgm migrate
CONFIG
cbpgm
's cli will look for a .cbpgm.js
file in the current working directory. If it cannot find any, it will load a default config file.
The default config will look for a migrations
dir in the current working directory, and it will let pg.Client
connect using the usual postgres-specific environment variables, which are documented here.
// .cbpgm.js
{
pg: {
// Options used to initialise node-progress client
// See: https://node-postgres.com/api/client
},
// directory where all migrations are stored
dir: path.join(process.cwd(), "migrations")
}
Commands
rollback
- rollback the last run migrationsmigrate
- create db if not exists & run all pending migrationsrecreate
- equal todropdb
,migrate
createdb
- create without migrationsdropdb
- drop the db
PROGRAMMATIC API
All any of the commands as a function with config
as first param. Returns a promise. Eg await require("cbpgm").migrate({ dir: "migrations", pg: { host: "localhost" }})
0.1.1-alpha
2 years ago
0.1.2-alpha
2 years ago
0.1.0-alpha
2 years ago
0.0.2-alpha
3 years ago
0.0.1
3 years ago
0.0.1-alpha4
3 years ago
0.0.1-alpha3
3 years ago
0.0.1-alpha2
3 years ago
0.0.1-alpha
3 years ago