feat: delete page

This commit is contained in:
Nicolas Giard
2019-01-26 18:35:56 -05:00
committed by Nick
parent faa1f389d9
commit 658c105ab5
24 changed files with 2126 additions and 2955 deletions

View File

@@ -0,0 +1,15 @@
exports.up = knex => {
return knex.schema
.table('pageHistory', table => {
table.string('action').defaultTo('updated')
table.dropForeign('pageId')
})
}
exports.down = knex => {
return knex.schema
.table('pageHistory', table => {
table.dropColumn('action')
table.integer('pageId').unsigned().references('id').inTable('pages')
})
}

View File

@@ -0,0 +1,28 @@
const path = require('path')
const fs = require('fs-extra')
const semver = require('semver')
/* global WIKI */
module.exports = {
/**
* Gets the migration names
* @returns Promise<string[]>
*/
async getMigrations() {
const absoluteDir = path.join(WIKI.SERVERPATH, 'db/migrations')
const migrationFiles = await fs.readdirAsync(absoluteDir)
return migrationFiles.sort(semver.compare).map(m => ({
file: m,
directory: absoluteDir
}))
},
getMigrationName(migration) {
return migration.file;
},
getMigration(migration) {
return require(path.join(WIKI.SERVERPATH, 'db/migrations', migration.file));
}
}