Created
January 17, 2015 06:47
-
-
Save mirhec/d438d7b8d71a399fb069 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
## This creates the db. If there occurs an error | |
## it will be printed out. If it succeeds, the | |
## callback next will be called. | |
### | |
createDb: (next) -> | |
r.dbCreate(config.rethinkdb.db).run @conn, (err, result) => | |
if (err) and (not err.message.match(/Database `.*` already exists/)) | |
console.log "Could not create the database `" + config.db + "`" | |
console.log err | |
process.exit 1 | |
console.log "Database `" + config.rethinkdb.db + "` created." | |
if next? | |
next() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment