east-rethink
Advanced tools
Comparing version 0.5.0 to 1.0.0
@@ -6,2 +6,3 @@ 'use strict'; | ||
const Path = require('path'); | ||
const Util = require('./util'); | ||
@@ -17,3 +18,4 @@ const Adapter = function (params) { | ||
this.params.configure = (cb) => cb(null, params.database); | ||
} else { | ||
} | ||
else { | ||
this.params.configure = this.params.database; | ||
@@ -42,3 +44,3 @@ } | ||
}); | ||
} | ||
}; | ||
@@ -59,16 +61,16 @@ Adapter.prototype.connect = function (callback) { | ||
this.db.table(self.params.tables); | ||
this.db.connect( (err) => { | ||
const callbackified = Util.callbackify(() => { | ||
return this.db.connect().then(() => { | ||
return this.db.establish({ [tableName]: { purge: false } }); | ||
}); | ||
}); | ||
callbackified((err) => { | ||
if (err) { | ||
return callback(err); | ||
} | ||
this.db.establish({ [tableName]: { purge: false } }, (err) => { | ||
if (err) { | ||
return callback(err); | ||
} | ||
return callback(null, { db: self.db }); | ||
}); | ||
return callback(null, { db: self.db }); | ||
}); | ||
@@ -80,3 +82,3 @@ }); | ||
this.db.close(() => { | ||
Util.callbackify(this.db.close.bind(this.db))(() => { | ||
@@ -92,3 +94,4 @@ return callback(); | ||
this.db[tableName].query({}, (err, migrations) => { | ||
const table = this.db[tableName]; | ||
Util.callbackify(table.query.bind(table))({}, (err, migrations) => { | ||
@@ -115,4 +118,7 @@ if (err) { | ||
this.db[tableName].insert({ name: name, created: Date.now() }, (err, id) => { | ||
const table = this.db[tableName]; | ||
const insert = Util.callbackify(table.insert.bind(table)); | ||
insert({ name, created: Date.now() }, (err, id) => { | ||
if (err) { | ||
@@ -131,4 +137,7 @@ return callback(err); | ||
this.db[tableName].remove({ name: name }, (err) => { | ||
const table = this.db[tableName]; | ||
const remove = Util.callbackify(table.remove.bind(table)); | ||
remove({ name }, (err) => { | ||
if (err) { | ||
@@ -135,0 +144,0 @@ return callback(err); |
{ | ||
"name": "east-rethink", | ||
"description": "rethinkdb adapter for \"east\" (node.js database migration tool)", | ||
"version": "0.5.0", | ||
"version": "1.0.0", | ||
"repository": { | ||
@@ -17,7 +17,10 @@ "type": "git", | ||
"dependencies": { | ||
"penseur": "7.x.x" | ||
"hoek": "5.x.x", | ||
"penseur": "8.x.x" | ||
}, | ||
"devDependencies": { | ||
"eslint-config-google": "^0.3.0" | ||
"eslint": "^4.18.1", | ||
"eslint-config-hapi": "^11.1.0", | ||
"eslint-plugin-hapi": "^4.1.0" | ||
} | ||
} |
# east rethink | ||
rethinkdb adapter for [east](https://github.com/okv/east) (node.js database migration tool) which uses | ||
rethinkdb adapter for [east](https://github.com/okv/east) (node.js database migration tool) which uses | ||
[pensuer](https://github.com/hueniverse/penseur) | ||
@@ -47,3 +47,3 @@ | ||
where | ||
where | ||
* `tables` is an array of the tables you wish to connect to in your database. | ||
@@ -80,8 +80,5 @@ * `database` is a json object with the following properties: `name` - database name, `migrationTable` - migration table name (optional - defaults to 'migration'), `connection` - a json object with `host` and `port` providing the host name and port number for your database respectively. | ||
var db = client.db; | ||
db.card.insert( { id: 1, type: 'apple', color: 'red' }, (err, results) => { | ||
if (err) return done(err); | ||
return done(null); | ||
}); | ||
db.card.insert( { id: 'red-apple', type: 'apple', color: 'red' }) | ||
.then(() => done(null), done); | ||
}; | ||
@@ -92,8 +89,4 @@ | ||
db.card.remove({ id: 1 }, (err) => { | ||
if (err) return done(err); | ||
return done(null); | ||
}); | ||
db.card.remove({ id: 1 }) | ||
.then(() => done(null), done); | ||
}; | ||
@@ -107,8 +100,4 @@ ``` | ||
var db = client.db; | ||
db.card.insert( { id: 2, type: 'banana', color: 'yellow' }, (err, results) => { | ||
if (err) return done(err); | ||
return done(null); | ||
}); | ||
db.card.insert( { id: 2, type: 'banana', color: 'yellow' }) | ||
.then(() => done(null), done); | ||
}; | ||
@@ -181,2 +170,2 @@ | ||
run [east](https://github.com/okv/east#running-test) tests with this adapter | ||
run [east](https://github.com/okv/east#running-test) tests with this adapter |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8239
8
135
1
2
3
167
+ Addedhoek@5.x.x
+ Addedboom@7.3.0(transitive)
+ Addedbounce@1.2.3(transitive)
+ Addedhoek@5.0.46.1.3(transitive)
+ Addedjoi@14.3.1(transitive)
+ Addedpenseur@8.12.3(transitive)
+ Addedtopo@3.0.3(transitive)
- Removedboom@5.3.3(transitive)
- Removedhoek@4.3.1(transitive)
- Removeditems@2.2.1(transitive)
- Removedjoi@11.4.0(transitive)
- Removedpenseur@7.15.0(transitive)
- Removedtopo@2.1.1(transitive)
Updatedpenseur@8.x.x