Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log('-');
console.log('--');
console.log('--- Database drop!!! DANGER!!! ----');
console.log('--');
console.log('-');
var confirm = process.argv[2];
if (!confirm) {
// alows user set new user data
confirm = sget('Are you sure you want to reset the database??. \n y or n?');
confirm = confirm.replace('\n','');
}
if (confirm === 'y') {
Sails.load({
port: 1930,
hooks: {
grunt: false,
socket: false,
pubsub: false
},
models: {
migrate: 'drop'
},
orm: {
_hookTimeout: 50000
},
environment: 'development'
},function loadSailsToDropDB(err, sails) {
if (err) {
return doneAll(err);
module.exports = function loadSails(cb){
Sails.load({
port: 1930,
hooks: {
grunt: false,
socket: false,
pubsub: false
},
orm: {
_hookTimeout: 40000
}
},function(err, sails) {
if (err) {
return cb(err);
}
// here you can load fixtures, etc.
cb(err, sails);
});
benchmark('first time, no hooks', function(cb) {
var sails = require('sails');
sails.load({
log: { level: 'error' },
globals: false,
loadHooks: []
}, cb);
});
benchmark('with moduleloader hook', function(cb) {
this.expected = 25;
this.comment = 'should be faster b/c of require cache';
var sails = require('sails');
sails.load({
log: { level: 'error' },
globals: false,
loadHooks: ['moduleloader']
}, cb);
});
require("../makedb")(function(err) {
if(err) return process.exit(1);
Sails.load({
environment: 'development',
port: process.env.PORT,
hooks: {
grunt: false
}
}, function callback(error, sails) {
if(error) {
Sails.log.error("Failed to prepare database:",error)
return process.exit(1);
}
sails.log("Database migrations completed!")
process.exit()
});