From f5fa2ad4682c4cea8af9014e4823aa82a96a2aa9 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sat, 28 Mar 2020 17:26:08 -0400 Subject: [PATCH] fix: sqlite pageHistory migration update query --- server/db/migrations-sqlite/2.2.17.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/db/migrations-sqlite/2.2.17.js b/server/db/migrations-sqlite/2.2.17.js index 7ee13f4c..2cd3a62f 100644 --- a/server/db/migrations-sqlite/2.2.17.js +++ b/server/db/migrations-sqlite/2.2.17.js @@ -3,7 +3,7 @@ exports.up = knex => { .alterTable('pageHistory', table => { table.string('versionDate').notNullable().defaultTo('') }) - .raw(`UPDATE pageHistory AS h1 INNER JOIN pageHistory AS h2 ON h2.id = (SELECT prev.id FROM pageHistory AS prev WHERE prev.pageId = h1.pageId AND prev.id < h1.id ORDER BY prev.id DESC LIMIT 1) SET h1.versionDate = h2.createdAt`) + .raw(`UPDATE pageHistory AS h1 SET versionDate = COALESCE((SELECT createdAt FROM pageHistory AS h2 WHERE h2.pageId = h1.pageId AND h2.id < h1.id ORDER BY h2.id DESC LIMIT 1), h1.createdAt, '')`) } exports.down = knex => { }