daf-data-store
Advanced tools
Comparing version 0.10.1 to 0.10.3
@@ -371,3 +371,3 @@ "use strict"; | ||
case 0: | ||
query = "SELECT * FROM ( SELECT m.id, m.\"timestamp\", m.receiver AS did, md. \"type\" AS sourceType, md.id AS sourceId FROM messages AS m\n LEFT JOIN messages_meta_data AS md ON m.id = md.message_id order by m.timestamp desc) GROUP BY did, sourceType"; | ||
query = "SELECT * FROM ( SELECT m.\"timestamp\", m.receiver AS did, md. \"type\" , md.id FROM messages AS m\n LEFT JOIN messages_meta_data AS md ON m.id = md.message_id order by m.timestamp desc) GROUP BY did, \"type\", id"; | ||
return [4 /*yield*/, this.db.rows(query, [])]; | ||
@@ -374,0 +374,0 @@ case 1: return [2 /*return*/, _a.sent()]; |
@@ -62,3 +62,2 @@ "use strict"; | ||
messages = _c.sent(); | ||
console.log('AAAA', messages); | ||
return [2 /*return*/, messages.filter(function (item) { return item.id !== message.id; })]; | ||
@@ -65,0 +64,0 @@ } |
@@ -56,3 +56,3 @@ "use strict"; | ||
var debug_1 = __importDefault(require("debug")); | ||
var debug = debug_1.default('db-migrations'); | ||
var debug = debug_1.default('daf:data-store:db-migrations'); | ||
var availableMigrations = [_001_initial_1.initial, _002_second_1.second]; | ||
@@ -79,6 +79,3 @@ exports.insertLastMigrationId = function (db, id) { | ||
if (rows[0] && rows[0].migrationId) { | ||
debug('Latest migrationId:' + | ||
rows[0].migrationId + | ||
' finished at:' + | ||
rows[0].timestamp); | ||
debug('Latest migrationId:' + rows[0].migrationId + ' finished at:' + rows[0].timestamp); | ||
lastMigrationId = parseInt(rows[0].migrationId, 10); | ||
@@ -85,0 +82,0 @@ } |
@@ -6,2 +6,14 @@ # Change Log | ||
## [0.10.3](https://github.com/uport-project/daf/compare/v0.10.2...v0.10.3) (2019-12-12) | ||
### Bug Fixes | ||
* EventEmmiter ([dc52b55](https://github.com/uport-project/daf/commit/dc52b55aad6c612266ce136636f6aa65e524b59b)) | ||
* Unifying debug messages ([efb4f3b](https://github.com/uport-project/daf/commit/efb4f3bf9f6d3f0d412eb80da7bb4ae92ce8ca72)) | ||
## [0.10.1](https://github.com/uport-project/daf/compare/v0.10.0...v0.10.1) (2019-12-10) | ||
@@ -8,0 +20,0 @@ |
{ | ||
"name": "daf-data-store", | ||
"description": "DID Agent Framework Data Store", | ||
"version": "0.10.1", | ||
"version": "0.10.3", | ||
"main": "build/index.js", | ||
@@ -12,3 +12,3 @@ "types": "build/index.d.ts", | ||
"blakejs": "^1.1.0", | ||
"daf-core": "^0.10.0", | ||
"daf-core": "^0.10.3", | ||
"debug": "^4.1.1", | ||
@@ -31,3 +31,3 @@ "sql-bricks-sqlite": "^0.1.0" | ||
"keywords": [], | ||
"gitHead": "bcfa660259186f0f287e9718361a538e4d559833" | ||
"gitHead": "7714b6dd24142a6aa55fe863af59dc35eeb7b7ad" | ||
} |
@@ -261,4 +261,4 @@ import { Message } from 'daf-core' | ||
async latestMessageTimestamps() { | ||
let query = `SELECT * FROM ( SELECT m.id, m."timestamp", m.receiver AS did, md. "type" AS sourceType, md.id AS sourceId FROM messages AS m | ||
LEFT JOIN messages_meta_data AS md ON m.id = md.message_id order by m.timestamp desc) GROUP BY did, sourceType` | ||
let query = `SELECT * FROM ( SELECT m."timestamp", m.receiver AS did, md. "type" , md.id FROM messages AS m | ||
LEFT JOIN messages_meta_data AS md ON m.id = md.message_id order by m.timestamp desc) GROUP BY did, "type", id` | ||
@@ -265,0 +265,0 @@ return await this.db.rows(query, []) |
@@ -13,3 +13,2 @@ import { DataStore } from './data-store' | ||
const messages = await dataStore.findMessages({ threadId: message.threadId }) | ||
console.log('AAAA', messages) | ||
return messages.filter((item: any) => item.id !== message.id) | ||
@@ -16,0 +15,0 @@ }, |
@@ -6,3 +6,3 @@ import { initial } from './001.initial' | ||
const debug = Debug('db-migrations') | ||
const debug = Debug('daf:data-store:db-migrations') | ||
@@ -20,19 +20,8 @@ const availableMigrations = [initial, second] | ||
await db.run( | ||
'CREATE TABLE IF NOT EXISTS migrations (migrationId TEXT, timestamp TEXT)', | ||
[], | ||
) | ||
const rows = await db.rows( | ||
'SELECT * FROM migrations ORDER BY migrationId DESC LIMIT 1', | ||
[], | ||
) | ||
await db.run('CREATE TABLE IF NOT EXISTS migrations (migrationId TEXT, timestamp TEXT)', []) | ||
const rows = await db.rows('SELECT * FROM migrations ORDER BY migrationId DESC LIMIT 1', []) | ||
let lastMigrationId = -1 | ||
if (rows[0] && rows[0].migrationId) { | ||
debug( | ||
'Latest migrationId:' + | ||
rows[0].migrationId + | ||
' finished at:' + | ||
rows[0].timestamp, | ||
) | ||
debug('Latest migrationId:' + rows[0].migrationId + ' finished at:' + rows[0].timestamp) | ||
lastMigrationId = parseInt(rows[0].migrationId, 10) | ||
@@ -39,0 +28,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
138316
2185
Updateddaf-core@^0.10.3