You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9 lines
384 B

  1. exports.up = knex => {
  2. return knex.schema
  3. .alterTable('pageHistory', table => {
  4. table.string('versionDate').notNullable().defaultTo('')
  5. })
  6. .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, '')`)
  7. }
  8. exports.down = knex => { }