mirror of https://github.com/requarks/wiki
parent
efab00fa0c
commit
ab463fcae1
@ -0,0 +1,13 @@
|
||||
exports.up = knex => {
|
||||
return knex.schema
|
||||
.createTable('pageLinks', table => {
|
||||
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')
|
||||
}
|
@ -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')
|
||||
}
|
Loading…
Reference in new issue