Skip to content

Commit cb84136

Browse files
committed
Housekeeping
1 parent 107dc61 commit cb84136

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

index.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var DB = require('sharedb').DB;
2-
var pg = require('pg')
2+
var pg = require('pg');
33

44
// Postgres-backed ShareDB database
55

@@ -29,7 +29,6 @@ function rollback(client, done) {
2929
// Persists an op and snapshot if it is for the next version. Calls back with
3030
// callback(err, succeeded)
3131
PostgresDB.prototype.commit = function(collection, id, op, snapshot, callback) {
32-
console.log(collection, id, op, snapshot)
3332
/*
3433
* op: CreateOp {
3534
* src: '24545654654646',
@@ -60,10 +59,9 @@ PostgresDB.prototype.commit = function(collection, id, op, snapshot, callback) {
6059
'SELECT max(version) AS max_version FROM ops WHERE collection = $1 AND doc_id = $2',
6160
[collection, id],
6261
function(err, res) {
63-
var max_version = res.rows[0].max_version
62+
var max_version = res.rows[0].max_version;
6463
if (max_version == null)
65-
max_version = 0
66-
console.log(snapshot.v, max_version)
64+
max_version = 0;
6765
if (snapshot.v !== max_version + 1) {
6866
return callback(null, false);
6967
}
@@ -149,7 +147,7 @@ PostgresDB.prototype.getSnapshot = function(collection, id, fields, callback) {
149147
row.data,
150148
undefined // TODO: metadata
151149
)
152-
callback(null, snapshot)
150+
callback(null, snapshot);
153151
} else {
154152
var snapshot = new PostgresSnapshot(
155153
id,
@@ -158,7 +156,7 @@ PostgresDB.prototype.getSnapshot = function(collection, id, fields, callback) {
158156
undefined,
159157
undefined
160158
)
161-
callback(null, snapshot)
159+
callback(null, snapshot);
162160
}
163161
}
164162
)
@@ -181,7 +179,6 @@ PostgresDB.prototype.getOps = function(collection, id, from, to, callback) {
181179
callback(err);
182180
return;
183181
}
184-
console.log(collection, id, from, to)
185182
client.query(
186183
'SELECT version, operation FROM ops WHERE collection = $1 AND doc_id = $2 AND version >= $3 AND version < $4',
187184
[collection, id, from, to],

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sharedb-postgres",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "PostgreSQL adapter for ShareDB",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)