mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-17 23:53:25 +02:00
Ported CLI from commander to yargs because yargs suits our large CLI better and is easier to develop with. Split commands into separate files since the file was getting annoyingly long.
This commit is contained in:
22
lib/cli/migrate/index.js
Normal file
22
lib/cli/migrate/index.js
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports.command = 'migrate'
|
||||
|
||||
module.exports.describe = 'Migrates the database to the latest version.'
|
||||
|
||||
module.exports.builder = function(yargs) {
|
||||
return yargs
|
||||
}
|
||||
|
||||
module.exports.handler = function() {
|
||||
var logger = require('../../util/logger')
|
||||
var log = logger.createLogger('cli:migrate')
|
||||
var db = require('../../db')
|
||||
|
||||
return db.setup()
|
||||
.then(function() {
|
||||
process.exit(0)
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.fatal('Migration had an error:', err.stack)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user