-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
npm -g install prego
Global installation is needed to use pmigrate
, migration command line tool. If you prefer to use programmatic migrations interface, you can install it locally only.
Easiest way is to have configuration file in you project's root directory. Currently, prego looks for ./config(.js|.coffee), imports it and checks exports.dbConnectionString
where should be connection string suitable for the pg module, such as
exports.dbConnectionString = "postgres://user:passw@localhost:5432/mydbname"
Config module could do whatever logic you need to calculate suitable connection string, say, depending on the
deployment target, debug mode or whatever you like. This is the way pmigrate
tool works.
Alternatively, you can initialize in the code:
prego = require '../lib/db'
prego.setConnectionString "postgres://localhost:5432/db_name"
but in this case pmigrate
tool won't work. Issue request for altenative configuration if need.
If you need to trace what SQL statements prego executes and some more debug output, enable it with
prego.enableSqlLog true
Or disable it by passing false.