Commit f5fa2ad4 authored by NGPixel's avatar NGPixel

fix: sqlite pageHistory migration update query

parent 327be052
...@@ -3,7 +3,7 @@ exports.up = knex => { ...@@ -3,7 +3,7 @@ exports.up = knex => {
.alterTable('pageHistory', table => { .alterTable('pageHistory', table => {
table.string('versionDate').notNullable().defaultTo('') 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 => { } exports.down = knex => { }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment