-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setup/teardown #25
Comments
+1 |
I have two thoughts on this:
An example of number 1 would be: var mysql = require('mysql')
module.exports = MysqlStore
MysqlStore (configString) {
this.db = mysql.createConneciton(configString)
}
MysqlStore.prototype.load = function (fn) {
this.db.connect(function (err) {
if (err) return fn(err)
// load state from mysql, or even inherit this from the FileStore, call fn when done
fn(null, state)
})
}
MysqlStore.prototype.safe = function (set, fn) {
// do save stuff, but save is called after each migration, so dont close db
} It should work, and does not require any new api in the core module. You could even set it up easily to expose a Option number 2 is much more straight forward but means added api and complexity. Would love to get opinions on which way to go. |
Since there is a lack of activity on this, closing. |
Plz, add setup/teardown functions to open/close db connection before/after couple of migrations
The text was updated successfully, but these errors were encountered: