feat: tags on page fetch + pageLinks table schema

This commit is contained in:
Nick
2019-09-02 18:32:33 -04:00
parent efab00fa0c
commit ab463fcae1
5 changed files with 102 additions and 40 deletions

View File

@@ -0,0 +1,19 @@
/* global WIKI */
exports.up = knex => {
const dbCompat = {
charset: (WIKI.config.db.type === `mysql` || WIKI.config.db.type === `mariadb`)
}
return knex.schema
.createTable('pageLinks', table => {
if (dbCompat.charset) { table.charset('utf8mb4') }
table.increments('id').primary()
table.integer('sourcePageId').unsigned().references('id').inTable('pages').onDelete('CASCADE')
table.integer('targetPageId').unsigned().references('id').inTable('pages').onDelete('CASCADE')
})
}
exports.down = knex => {
return knex.schema
.dropTableIfExists('pageLinks')
}