Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function (callback) {
r.dbDrop(name).run(conn, function (err, result) {
callback();
});
},
// create blog dB
}).then(() => {
// delete project_internal
green(` └── Deleting empty "${project}_internal" database`);
return r.dbDrop(`${project}_internal`).run(this.conn);
});
}
it('creates new database (complex tables pre-loaded)', async () => {
const prep = new Penseur.Db('penseurtest');
await prep.connect();
await RethinkDB.dbDrop('penseurtest').run(prep._connection);
await prep.close();
const db = new Penseur.Db('penseurtest');
db.table({ test: { id: 'increment' } });
await db.establish(['test']);
await db.close();
});
it('creates new database', async () => {
const db = new Penseur.Db('penseurtest');
await db.connect();
await RethinkDB.dbDrop(db.name).run(db._connection);
await db.establish({ test: { secondary: 'other' } });
const result = await RethinkDB.db(db.name).table('test').indexList().run(db._connection);
expect(result).to.equal(['other']);
await db.close();
});
return r.connect().then((conn) => {
return r.dbDrop(dbName).run(conn)
.finally(() => conn.close());
});
};
.then(conn => {
console.log('Connected to demo DB')
return r.branch(r.dbList().contains('demo'), r.dbDrop('demo'), null).run(conn)
.then(() => r.dbCreate('demo').run(conn))
.then(() => {
console.log('DB Wiped')
process.exit()
})
})
.then(function (dbs) {
if(dbs.indexOf('test') !== -1) {
console.log('Deleting DB test');
return r.dbDrop('test').run(Connection);
}
return dbs;
})
.then(function () {
suite.on('complete', function() {
rdb.dbDrop(CFG.dbname).run(conn, function cb(err, res) {
if (err) throw err;
pbe.close(function cb(err, res) {
if (err) throw err;
});
});
});
exports.databaseDelete = function (req, res) {
var d = req.body;
r.dbDrop(d.db).run( connection, {timeFormat: 'raw'}, function(error, result) {
if (error) handleError(error);
res.json({
error: error,
result: result
});
})
}
exports.tableDelete = function (req, res) {
return new Promise(function(resolve, reject) {
r.dbDrop(dbName).run(conn, function(err, results) {
if (err) {
reject(err);
} else {
resolve();
}
});
});
};