2.5.122.js 593 B

1234567891011121314151617181920
  1. /* global WIKI */
  2. exports.up = knex => {
  3. const dbCompat = {
  4. blobLength: (WIKI.config.db.type === `mysql` || WIKI.config.db.type === `mariadb`),
  5. charset: (WIKI.config.db.type === `mysql` || WIKI.config.db.type === `mariadb`)
  6. }
  7. return knex.schema
  8. .createTable('userAvatars', table => {
  9. if (dbCompat.charset) { table.charset('utf8mb4') }
  10. table.integer('id').primary()
  11. if (dbCompat.blobLength) {
  12. table.specificType('data', 'LONGBLOB').notNullable()
  13. } else {
  14. table.binary('data').notNullable()
  15. }
  16. })
  17. }
  18. exports.down = knex => { }