.then(function (dbList) { if (utils.contains(dbList, 'test')) { return connection.run(r.dbDrop('test')); } else { return null; } })
function(err, dblist) { if (err) throw err; var dbExists = dblist.indexOf('audit') != -1; if (dbExists && force) { r.dbDrop('audit').run(connection, function() {}); } if (!dbExists || force) { r.dbCreate('audit').run(connection, function() {});; connection.use('audit'); ['courses', 'students', 'requirements', 'degrees'].forEach(function(tableName) { r.db('audit').tableCreate(tableName).run(connection, function (err, result) { if (err) throw err; console.log("create table ", tableName ,": ", JSON.stringify(result, null, 2)); }) r.table(tableName).insert(model[tableName]).run(connection, function (err, result) { if (err) throw err; console.log("insert bootstrap data into ", tableName, ": ", JSON.stringify(result, null, 2)); }) }) } }
}, function(err, conn){ r.dbDrop('notinet').run(conn, function(err, data){ if(err) console.log(err); if(data) console.log(data); process.exit(); }); }
}, function(err, conn) { if(err) throw err; console.log("Dropping old database."); r.dbDrop(dbname).run(conn) .then(function(res) { return r.dbCreate(dbname).run(conn); }) .then(function(res) { console.log("Created database."); console.log("Creating Messages"); return r.db(dbname).tableCreate("Messages").run(conn); }) .then(function() { return r.db(dbname).table("Messages").indexCreate("statusAndDate", [r.row("status"), r.row("date")]).run(conn); }) .then(function(res) { console.log("Creating Announcements"); return r.db(dbname).tableCreate("Announcements").run(conn); }) .then(function(res) { console.log("Creating Images"); return r.db(dbname).tableCreate("Images").run(conn); }) .then(function() { return r.db(dbname).table("Images").indexCreate("statusAndDate", [r.row("status"), r.row("date")]).run(conn); }) .then(function(res) { process.exit(0); }); });
it('dbDrop - 1', function(done) { var query = r.dbDrop(TEST_DB); compare(query, done, function(doc) { delete doc.config_changes[0].old_val.id; return doc; }); });
r.connect({host : config.host, port : config.port},function(err,conn){ assert.ok(err === null,err); r.dbDrop(dbName).run(conn,function(err,result){ conn.close(); next(err,result); }); });
r.connect(config).then(function(conn) { connection = conn; r.dbDrop("reqlite").run(connection).error(function() { // Ignore the error }).finally(function(result) { done(); }); }).error(done);
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; }); }); });
it('Drop a database', function(done) { r.dbDrop("reqlite").run(connection).then(function(result) { assert.deepEqual(result, {dropped: 1}) return r.dbList().run(connection); }).then(function(result) { assert.equal(result.indexOf("reqlite"), -1); done(); }).error(done); });
test.afterEach.always('cleanup database', async t => { let db = t.context.db let dbName = t.context.dbName await db.disconnect() t.false(db.connected, 'should be disconnected') let conn = await r.connect({}) await r.dbDrop(dbName).run(conn) })
exports.databaseDelete = function (req, res) { var d = req.body; r.dbDrop(d.database).run( connection, function(error, result) { if (error) handleError(error); res.json({ error: error, result: result }); }) }
RethinkDBProvider.prototype.purge = function (callback) { var self = this; r.dbDrop(self.options.db).run(self.client, function (err) { if (err) return callback(err); return callback(null); }); };
function dropDatabase(callback){ var exsists = r.db('vp').info() if(exsists) { r.dbDrop(app.db_name).run(app.con, function(err, result){ callback(result) }) } else { callback({ skipped: 1}) } }
test.afterEach('disconnect database', async t => { let db = t.context.db let dbName = t.context.dbName await db.disconnect() t.false(db.connected, 'should be disconnected') // Borrar base de datos let conn = await r.connect({}) await r.dbDrop(dbName).run(conn) })
drop( done ){ rdb.dbDrop( DB_NAME ).run( this.conn, ( err, res ) => { if( err ){ throw err; } this.conn.close(( err ) => { if( err ){ throw err; } done(); }); } ); }
test.afterEach.always('cleanup database', async t => { // obteniendo el contexto let db = t.context.db let dbName = t.context.dbName // desconexion a db await db.disconnect() t.false(db.connected, 'should be disconnected') // cleanup database - pequeña logica de conexion con options por defecto de host y port let conn = await r.connect({}) await r.dbDrop(dbName).run(conn) })
r.connect( {host: 'localhost', port: 28015}, function(err, conn) { if (err) throw err; connection = conn; if (!createDB) { conn.use('webApp'); } if (createDB) { r.dbDrop('webApp').run(conn, function(err, result) { if(err) throw err; }); r.dbCreate('webApp').run(conn, function(err, result) { if (err) throw err; r.db('webApp').tableCreate('events').run(conn, function(err, result) { if (err) throw err; console.log(JSON.stringify(result, null, 2)); }); r.db('webApp').tableCreate('users').run(conn, function(err, result) { if (err) throw err; console.log(JSON.stringify(result, null, 2)); conn.use('webApp'); r.table('users').indexCreate('username').run(conn, function(err, result) { if (err) throw err; console.log(JSON.stringify(result, null, 2)); r.table('users').insert({ username: config.username, password: bcrypt.hashSync(config.password), }).run(conn, function(err, result) { if (err) throw err; console.log(JSON.stringify(result, null, 2)); }) }) r.table('users').indexCreate('token').run(conn, function(err, result) { if (err) throw err; console.log(JSON.stringify(result, null, 2)); }) }) }) } });
module.exports.reset = function (data, callback) { r.dbDrop(config.db.db).runp(); r.dbCreate(config.db.db).runp(); r.db(config.db.db).tableCreate({tableName:'user', primaryKey:'username'}).runp(); r.db(config.db.db).table('user').run(); r.table('user').insert(config.testUsers).runp(); r.table('user').runp(); callback(null); };
gulp.task('ingest', async (done) => { try { await reql(r.dbDrop('tagger')); console.log('Dropped table'); await reql(r.dbCreate('tagger')); console.log('Created database'); await reql(r.db('tagger').tableCreate('places')); console.log('Created table'); await Promise.all(data.map(poi => reql(r.db('tagger').table('places').insert(poi)))); console.log('Successfully added all records'); done(); } catch (e) { console.log(e); } });
function dropDb(name, cb) { r.dbDrop(name).run(connection, function(error, result) { if (error) console.log(error); if ((result != null) && (result.created === 1)) { console.log('Db `'+name+'` created'); } else { console.log('Error: Database `'+config.db+'` was not deleted.'); } if (typeof cb === 'function') { cb() } }); }
.then(function(connection) { conn = connection; return r.dbDrop('test').run(conn) .then(function() { return r.dbCreate('test').run(conn); }) .then(function() { return r.tableCreate('t1').run(conn); }) .finally(function() { return r.table('t1').insert({ id: 1, cnt: 'test1' }).run(conn).then(function() { return r.table('t1').insert({ id: 2, cnt: 'test2' }).run(conn); }); }) })
r.connect( connectionParams.rethinkdb, function( error, _connection ){ if( error ) { return _callback(error) } connection = _connection; r.dbDrop( connectionParams.rethinkdb.db ).run( connection, function(err) { if (err) { // do nothing, this just happens the first time } r.dbCreate( connectionParams.rethinkdb.db ).run(connection, function(err) { if (err) { return _callback(err) } createTable() }) } ); });
prep.connect((err) => { expect(err).to.not.exist(); RethinkDB.dbDrop('penseurtest').run(prep._connection, (err, dropped) => { expect(err).to.not.exist(); prep.close(); const db = new Penseur.Db('penseurtest'); db.table({ test: { id: 'increment' } }); db.establish(['test'], (err) => { expect(err).to.not.exist(); db.close(done); }); }); });
.then(function (conn) { return r.dbDrop(connectionOpts.db).run(conn) .catch(function () { }) .then(function () { return r.dbCreate(connectionOpts.db).run(conn); }) .then(function () { return q.all(tables.map(function (table) { return r.tableCreate(table).run(conn) .catch(function () { }) .then(function () { return r.table(table).indexCreate('exampleIndex'); }); })); }) .then(function () { return conn.close(); }); })
db.connect((err) => { expect(err).to.not.exist(); RethinkDB.dbDrop(db.name).run(db._connection, (err, dropped) => { expect(err).to.not.exist(); db.establish({ test: { secondary: 'other' } }, (err) => { expect(err).to.not.exist(); RethinkDB.db(db.name).table('test').indexList().run(db._connection, (err, result) => { expect(err).to.not.exist(); expect(result).to.equal(['other']); db.close(done); }); }); }); });
}).then(function(conn) { connections.reqlite = conn; this.query = r.dbDrop(TEST_DB); return this.query.run(connections.rethinkdb); }).catch(function() { // ignore errors
function dbDown(connection) { return r.dbDrop('TylerSirens'); }
it('dbDrop - 3', function(done) { var query = r.dbDrop('fo~o'); compare(query, done); });
this.connect( () => { rdb.dbDrop( DB_NAME ).run( this.conn, ( err, res ) => { done(); } ).catch( () => {} ); } );
it('dbCreate - 5 - follow up', function(done) { var query = r.dbDrop('foo_bar'); compare(query, done, function(result) { return result.dbs_dropped; }); });