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.

23 lines
673 B

  1. /* global WIKI */
  2. exports.up = knex => {
  3. const dbCompat = {
  4. charset: (WIKI.config.db.type === `mysql` || WIKI.config.db.type === `mariadb`)
  5. }
  6. return knex.schema
  7. .createTable('pageLinks', table => {
  8. if (dbCompat.charset) { table.charset('utf8mb4') }
  9. table.increments('id').primary()
  10. table.integer('pageId').unsigned().references('id').inTable('pages').onDelete('CASCADE')
  11. table.string('path').notNullable()
  12. table.string('localeCode', 5).notNullable()
  13. })
  14. .table('pageLinks', table => {
  15. table.index(['path', 'localeCode'])
  16. })
  17. }
  18. exports.down = knex => {
  19. return knex.schema
  20. .dropTableIfExists('pageLinks')
  21. }