浏览代码

fix: asset data type for mysql + mariadb

Nick 6 年之前
父节点
当前提交
c0d7e16ef7
共有 5 个文件被更改,包括 46 次插入563 次删除
  1. 5 0
      client/components/admin/admin-system.vue
  2. 1 1
      config.sample.yml
  3. 1 0
      server/core/kernel.js
  4. 21 0
      server/db/migrations/2.0.0-beta.148.js
  5. 18 562
      yarn.lock

+ 5 - 0
client/components/admin/admin-system.vue

@@ -90,6 +90,8 @@
                   v-list-tile-content
                     v-list-tile-title(v-html='dbVersion')
                     v-list-tile-sub-title {{ info.dbHost }}
+
+                v-alert.mt-3(:value='isDbLimited', color='deep-orange', icon='warning') Your database version is not fully supported. Some functionality may be limited or not work as expected.
 </template>
 
 <script>
@@ -127,6 +129,9 @@ export default {
         default:
           return ''
       }
+    },
+    isDbLimited() {
+      return this.info.dbType === 'MySQL' && this.dbVersion.indexOf('5.') === 0
     }
   },
   methods: {

+ 1 - 1
config.sample.yml

@@ -15,7 +15,7 @@ port: 3000
 # ---------------------------------------------------------------------
 # Supported Database Engines:
 # - postgres = PostgreSQL 9.5 or later
-# - mysql = MySQL 5.7.8
+# - mysql = MySQL 8.0 or later (5.7.8 partially supported, refer to docs)
 # - mariadb = MariaDB 10.2.7 or later
 # - mssql = MS SQL Server 2012 or later
 # - sqlite = SQLite 3.9 or later

+ 1 - 0
server/core/kernel.js

@@ -8,6 +8,7 @@ module.exports = {
     WIKI.logger.info('=======================================')
     WIKI.logger.info(`= Wiki.js ${_.padEnd(WIKI.version + ' ', 29, '=')}`)
     WIKI.logger.info('=======================================')
+    WIKI.logger.info('Initializing...')
 
     WIKI.models = require('./db').init()
 

+ 21 - 0
server/db/migrations/2.0.0-beta.148.js

@@ -0,0 +1,21 @@
+exports.up = knex => {
+  const dbCompat = {
+    blobLength: (WIKI.config.db.type === `mysql` || WIKI.config.db.type === `mariadb`)
+  }
+  return knex.schema
+    .table('assetData', table => {
+      if (dbCompat.blobLength) {
+        table.dropColumn('data')
+      }
+    })
+    .table('assetData', table => {
+      if (dbCompat.blobLength) {
+        table.specificType('data', 'LONGBLOB').notNullable()
+      }
+    })
+}
+
+exports.down = knex => {
+  return knex.schema
+    .table('assetData', table => {})
+}

文件差异内容过多而无法显示
+ 18 - 562
yarn.lock


部分文件因为文件数量过多而无法显示