fix: db connection

pull/5698/head
NGPixel 3 years ago
parent 3a57145e3d
commit 7b060bec5f
No known key found for this signature in database
GPG Key ID: 8FDA2F1757F60D63

@ -47,7 +47,7 @@
"apollo-server": "2.25.2",
"apollo-server-express": "2.25.2",
"auto-load": "3.0.4",
"aws-sdk": "2.1043.0",
"aws-sdk": "2.1111.0",
"azure-search-client": "3.1.5",
"bcryptjs-then": "1.0.1",
"bluebird": "3.7.2",
@ -73,7 +73,7 @@
"elasticsearch7": "npm:@elastic/elasticsearch@7",
"emoji-regex": "9.2.2",
"eventemitter2": "6.4.5",
"express": "4.17.2",
"express": "4.17.3",
"express-brute": "1.0.1",
"express-session": "1.17.2",
"file-type": "15.0.1",
@ -98,7 +98,7 @@
"jsonwebtoken": "8.5.1",
"katex": "0.12.0",
"klaw": "3.0.0",
"knex": "0.21.7",
"knex": "1.0.5",
"lodash": "4.17.21",
"luxon": "1.25.0",
"markdown-it": "11.0.1",
@ -119,16 +119,13 @@
"mime-types": "2.1.34",
"moment": "2.29.1",
"moment-timezone": "0.5.31",
"mongodb": "3.6.5",
"ms": "2.1.3",
"mssql": "6.2.3",
"multer": "1.4.4",
"mysql2": "2.3.3",
"nanoid": "3.2.0",
"node-2fa": "1.1.2",
"node-cache": "5.1.2",
"nodemailer": "6.7.2",
"objection": "2.2.18",
"objection": "3.0.1",
"passport": "0.4.1",
"passport-auth0": "1.4.2",
"passport-azure-ad": "4.3.1",
@ -150,11 +147,11 @@
"passport-slack-oauth2": "1.1.1",
"passport-twitch-oauth": "1.0.0",
"pem-jwk": "2.0.0",
"pg": "8.4.1",
"pg": "8.7.3",
"pg-hstore": "2.3.4",
"pg-pubsub": "0.5.0",
"pg-query-stream": "3.3.1",
"pg-tsquery": "8.1.0",
"pg-pubsub": "0.6.1",
"pg-query-stream": "4.2.3",
"pg-tsquery": "8.3.0",
"pug": "3.0.2",
"punycode": "2.1.1",
"qr-image": "3.2.0",
@ -165,11 +162,10 @@
"safe-regex": "2.1.1",
"sanitize-filename": "1.6.3",
"scim-query-filter-parser": "2.0.4",
"semver": "7.3.5",
"semver": "7.3.6",
"serve-favicon": "2.5.0",
"simple-git": "2.21.0",
"solr-node": "1.2.1",
"sqlite3": "5.0.2",
"ssh2": "1.5.0",
"ssh2-promise": "1.0.2",
"striptags": "3.2.0",
@ -180,8 +176,8 @@
"uslug": "1.0.4",
"uuid": "8.3.2",
"validate.js": "0.13.1",
"winston": "3.3.3",
"xss": "1.0.10",
"winston": "3.7.2",
"xss": "1.0.11",
"yargs": "16.1.0"
},
"devDependencies": {

@ -24,9 +24,11 @@ module.exports = {
init() {
let self = this
WIKI.logger.info('Checking DB configuration...')
// Fetch DB Config
let dbConfig = (!_.isEmpty(process.env.DATABASE_URL)) ? process.env.DATABASE_URL : {
const dbConfig = (!_.isEmpty(process.env.DATABASE_URL)) ? process.env.DATABASE_URL : {
host: WIKI.config.db.host.toString(),
user: WIKI.config.db.user.toString(),
password: WIKI.config.db.pass.toString(),
@ -87,6 +89,7 @@ module.exports = {
async afterCreate(conn, done) {
// -> Set Connection App Name
await conn.query(`set application_name = 'Wiki.js'`)
done()
}
},
debug: WIKI.IS_DEBUG
@ -96,6 +99,7 @@ module.exports = {
// Load DB Models
WIKI.logger.info('Loading DB models...')
const models = autoload(path.join(WIKI.SERVERPATH, 'models'))
// Set init tasks
@ -124,6 +128,7 @@ module.exports = {
},
// -> Migrate DB Schemas
async syncSchemas () {
WIKI.logger.info('Ensuring DB migrations have been applied...')
return self.knex.migrate.latest({
tableName: 'migrations',
migrationSource,

@ -10,23 +10,26 @@ module.exports = {
}
const migrations = await knex('migrations')
if (_.some(migrations, m => m.name.indexOf('2.5.128') >= 0)) {
// TODO: 2.x MIGRATIONS for 3.0
WIKI.logger.error('Upgrading from 2.x is not yet supported. A future release will allow for upgrade from 2.x. Exiting...')
process.exit(1)
if (_.some(migrations, m => m.name.indexOf('2.0.0') === 0)) {
WIKI.logger.info('Found legacy 2.x installation of Wiki.js...')
if (_.some(migrations, m => m.name.indexOf('2.5.128') === 0)) {
// TODO: 2.x MIGRATIONS for 3.0
WIKI.logger.error('Upgrading from 2.x is not yet supported. A future release will allow for upgrade from 2.x. Exiting...')
process.exit(1)
// -> Cleanup migration table
await knex('migrations').truncate()
// -> Cleanup migration table
await knex('migrations').truncate()
// -> Advance to stable 3.0 migration state
await knex('migrations').insert({
name: '3.0.0.js',
batch: 1,
migration_time: knex.fn.now()
})
} else {
console.error('CANNOT UPGRADE FROM OLDER UNSUPPORTED VERSION. UPGRADE TO THE LATEST 2.X VERSION FIRST! Exiting...')
process.exit(1)
// -> Advance to stable 3.0 migration state
await knex('migrations').insert({
name: '3.0.0.js',
batch: 1,
migration_time: knex.fn.now()
})
} else {
console.error('CANNOT UPGRADE FROM OLDER UNSUPPORTED VERSION. UPGRADE TO THE LATEST 2.X VERSION FIRST! Exiting...')
process.exit(1)
}
}
}
}

@ -13,8 +13,8 @@
"dependencies": {
"@apollo/client": "3.5.10",
"@codemirror/autocomplete": "0.19.15",
"@codemirror/basic-setup": "0.19.1",
"@codemirror/closebrackets": "0.19.1",
"@codemirror/basic-setup": "0.19.3",
"@codemirror/closebrackets": "0.19.2",
"@codemirror/commands": "0.19.8",
"@codemirror/comment": "0.19.1",
"@codemirror/fold": "0.19.3",
@ -27,10 +27,10 @@
"@codemirror/lang-json": "0.19.2",
"@codemirror/lang-markdown": "0.19.6",
"@codemirror/matchbrackets": "0.19.4",
"@codemirror/search": "0.19.9",
"@codemirror/search": "0.19.10",
"@codemirror/state": "0.19.9",
"@codemirror/tooltip": "0.19.16",
"@codemirror/view": "0.19.47",
"@codemirror/view": "0.19.48",
"@lezer/common": "0.15.12",
"@quasar/extras": "1.13.5",
"@tiptap/core": "2.0.0-beta.174",
@ -71,7 +71,7 @@
"luxon": "2.3.1",
"pinia": "2.0.13",
"pug": "3.0.2",
"quasar": "2.6.5",
"quasar": "2.6.6",
"tippy.js": "6.3.7",
"uuid": "8.3.2",
"v-network-graph": "0.5.9",
@ -83,10 +83,10 @@
},
"devDependencies": {
"@intlify/vite-plugin-vue-i18n": "3.4.0",
"@quasar/app-vite": "1.0.0-beta.13",
"@quasar/app-vite": "1.0.0-beta.14",
"@types/lodash": "4.14.181",
"autoprefixer": "10.4.4",
"eslint": "8.12.0",
"eslint": "8.13.0",
"eslint-config-standard": "17.0.0-1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-n": "15.1.0",

@ -98,6 +98,10 @@ body::-webkit-scrollbar-thumb {
}
}
.q-select__dropdown-icon {
font-size: 16px;
}
// ------------------------------------------------------------------
// BUTTONS
// ------------------------------------------------------------------

@ -50,10 +50,10 @@
"@codemirror/view" "^0.19.0"
"@lezer/common" "^0.15.0"
"@codemirror/basic-setup@0.19.1":
version "0.19.1"
resolved "https://registry.yarnpkg.com/@codemirror/basic-setup/-/basic-setup-0.19.1.tgz#17b27d02f15c628eb62a85d01e3e1b1958933eb4"
integrity sha512-gLjD7YgZU/we6BzS/ecCmD3viw83dsgv5ZUaSydYbYx9X4w4w9RqYnckcJ+0GDyHfNr5Jtfv2Z5ZtFQnBj0UDA==
"@codemirror/basic-setup@0.19.3":
version "0.19.3"
resolved "https://registry.yarnpkg.com/@codemirror/basic-setup/-/basic-setup-0.19.3.tgz#b83e3ee43f632c0305f97771767d84c753d41a6b"
integrity sha512-2hfO+QDk/HTpQzeYk1NyL1G9D5L7Sj78dtaQP8xBU42DKU9+OBPF5MdjLYnxP0jKzm6IfQfsLd89fnqW3rBVfQ==
dependencies:
"@codemirror/autocomplete" "^0.19.0"
"@codemirror/closebrackets" "^0.19.0"
@ -66,23 +66,12 @@
"@codemirror/language" "^0.19.0"
"@codemirror/lint" "^0.19.0"
"@codemirror/matchbrackets" "^0.19.0"
"@codemirror/rectangular-selection" "^0.19.0"
"@codemirror/rectangular-selection" "^0.19.2"
"@codemirror/search" "^0.19.0"
"@codemirror/state" "^0.19.0"
"@codemirror/view" "^0.19.31"
"@codemirror/closebrackets@0.19.1":
version "0.19.1"
resolved "https://registry.yarnpkg.com/@codemirror/closebrackets/-/closebrackets-0.19.1.tgz#c93219d6800c27a880e569135b468cf4a05d903f"
integrity sha512-ZiLXT6u+VuBK5QnfBbt/Vmfd9Pg6449wn1DIOWFZHUOldg5eFn3VGGjYY2XWuHQz5WuK+7dXamV2KE885O1gyA==
dependencies:
"@codemirror/language" "^0.19.0"
"@codemirror/rangeset" "^0.19.0"
"@codemirror/state" "^0.19.2"
"@codemirror/text" "^0.19.0"
"@codemirror/view" "^0.19.44"
"@codemirror/closebrackets@^0.19.0":
"@codemirror/closebrackets@0.19.2", "@codemirror/closebrackets@^0.19.0":
version "0.19.2"
resolved "https://registry.yarnpkg.com/@codemirror/closebrackets/-/closebrackets-0.19.2.tgz#ff74dd78218cee57172623eb9ebf7b669fa6f4d4"
integrity sha512-ClMPzPcPP0eQiDcVjtVPl6OLxgdtZSYDazsvT0AKl70V1OJva0eHgl4/6kCW3RZ0pb2n34i9nJz4eXCmK+TYDA==
@ -263,7 +252,7 @@
dependencies:
"@codemirror/state" "^0.19.0"
"@codemirror/rectangular-selection@^0.19.0":
"@codemirror/rectangular-selection@^0.19.2":
version "0.19.2"
resolved "https://registry.yarnpkg.com/@codemirror/rectangular-selection/-/rectangular-selection-0.19.2.tgz#caa60114421b5c43244494c94203b65f666edb53"
integrity sha512-AXK/p5eGwFJ9GJcLfntqN4dgY+XiIF7eHfXNQJX5HhQLSped2wJE6WuC1rMEaOlcpOqlb9mrNi/ZdUjSIj9mbA==
@ -272,19 +261,7 @@
"@codemirror/text" "^0.19.4"
"@codemirror/view" "^0.19.48"
"@codemirror/search@0.19.9":
version "0.19.9"
resolved "https://registry.yarnpkg.com/@codemirror/search/-/search-0.19.9.tgz#b9548dfeb2028e6d5ecd1965f8f0ee50e2925603"
integrity sha512-h3MuwbUbiyOp6Np3IB5r4LH0w4inZvbtLO1Ipmz8RhElcGRiYr11Q6Bim8ocLfe08RmZT6B5EkTj1E8eNlugQQ==
dependencies:
"@codemirror/panel" "^0.19.0"
"@codemirror/rangeset" "^0.19.0"
"@codemirror/state" "^0.19.3"
"@codemirror/text" "^0.19.0"
"@codemirror/view" "^0.19.34"
crelt "^1.0.5"
"@codemirror/search@^0.19.0":
"@codemirror/search@0.19.10", "@codemirror/search@^0.19.0":
version "0.19.10"
resolved "https://registry.yarnpkg.com/@codemirror/search/-/search-0.19.10.tgz#4b0d91c53278db05088624ae04f164d66fd581cd"
integrity sha512-qjubm69HJixPBWzI6HeEghTWOOD8NXiHOTRNvdizqs8xWRuFChq9zkjD3XiAJ7GXSTzCuQJnAP9DBBGCLq4ZIA==
@ -316,18 +293,7 @@
"@codemirror/state" "^0.19.0"
"@codemirror/view" "^0.19.0"
"@codemirror/view@0.19.47":
version "0.19.47"
resolved "https://registry.yarnpkg.com/@codemirror/view/-/view-0.19.47.tgz#2163c3016d7680bf50dd695c0e3abdaf80f45363"
integrity sha512-SfbagKvJQl5dtt+9wYpo9sa3ZkMgUxTq+/hXDf0KVwIx+zu3cJIqfEm9xSx6yXkq7it7RsPGHaPasApNffF/8g==
dependencies:
"@codemirror/rangeset" "^0.19.5"
"@codemirror/state" "^0.19.3"
"@codemirror/text" "^0.19.0"
style-mod "^4.0.0"
w3c-keyname "^2.2.4"
"@codemirror/view@^0.19.0", "@codemirror/view@^0.19.22", "@codemirror/view@^0.19.23", "@codemirror/view@^0.19.31", "@codemirror/view@^0.19.34", "@codemirror/view@^0.19.39", "@codemirror/view@^0.19.44", "@codemirror/view@^0.19.48":
"@codemirror/view@0.19.48", "@codemirror/view@^0.19.0", "@codemirror/view@^0.19.22", "@codemirror/view@^0.19.23", "@codemirror/view@^0.19.31", "@codemirror/view@^0.19.34", "@codemirror/view@^0.19.39", "@codemirror/view@^0.19.44", "@codemirror/view@^0.19.48":
version "0.19.48"
resolved "https://registry.yarnpkg.com/@codemirror/view/-/view-0.19.48.tgz#1c657e2b0f8ed896ac6448d6e2215ab115e2a0fc"
integrity sha512-0eg7D2Nz4S8/caetCTz61rK0tkHI17V/d15Jy0kLOT8dTLGGNJUponDnW28h2B6bERmPlVHKh8MJIr5OCp1nGw==
@ -534,10 +500,10 @@
resolved "https://registry.yarnpkg.com/@positron/stack-trace/-/stack-trace-1.0.0.tgz#14fcc712a530038ef9be1ce6952315a839f466a8"
integrity sha1-FPzHEqUwA475vhzmlSMVqDn0Zqg=
"@quasar/app-vite@1.0.0-beta.13":
version "1.0.0-beta.13"
resolved "https://registry.yarnpkg.com/@quasar/app-vite/-/app-vite-1.0.0-beta.13.tgz#d71d229002588b5236c12d79b4cc2f52d013e8d1"
integrity sha512-l4NMmGiqgGkHDonumORFJlxZ/K1iDFbDdxrxWsmjFvTc4/peN3GdRd+cYEoP9xApp/O+BKno1+XVUVIuQp0Evg==
"@quasar/app-vite@1.0.0-beta.14":
version "1.0.0-beta.14"
resolved "https://registry.yarnpkg.com/@quasar/app-vite/-/app-vite-1.0.0-beta.14.tgz#69fd45938897de3f95243e1efc0f8e4c1a8ab144"
integrity sha512-DODuw6AnF4/90xbSmOy5BBvunTZxMdyOVazIFUfii+KZdokJ5Nr7PXZdNSvm5nel4AiOFJzdvtN1n8tCqdf+YQ==
dependencies:
"@quasar/fastclick" "1.1.5"
"@quasar/vite-plugin" "^1.0.9"
@ -2242,10 +2208,10 @@ eslint-visitor-keys@^3.1.0, eslint-visitor-keys@^3.3.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz#f6480fa6b1f30efe2d1968aa8ac745b862469826"
integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==
eslint@8.12.0:
version "8.12.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.12.0.tgz#c7a5bd1cfa09079aae64c9076c07eada66a46e8e"
integrity sha512-it1oBL9alZg1S8UycLm5YDMAkIhtH6FtAzuZs6YvoGVldWjbS08BkAdb/ymP9LlAyq8koANu32U7Ib/w+UNh8Q==
eslint@8.13.0:
version "8.13.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.13.0.tgz#6fcea43b6811e655410f5626cfcf328016badcd7"
integrity sha512-D+Xei61eInqauAyTJ6C0q6x9mx7kTUC1KZ0m0LSEexR0V+e94K12LmWX076ZIsldwfQ2RONdaJe0re0TRGQbRQ==
dependencies:
"@eslint/eslintrc" "^1.2.1"
"@humanwhocodes/config-array" "^0.9.2"
@ -3752,10 +3718,10 @@ qs@6.9.7:
resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.7.tgz#4610846871485e1e048f44ae3b94033f0e675afe"
integrity sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw==
quasar@2.6.5:
version "2.6.5"
resolved "https://registry.yarnpkg.com/quasar/-/quasar-2.6.5.tgz#f744e2f12c53430da58da413d31e0720cbd6a6fa"
integrity sha512-ABaFt6eXDtXwV6RUt8VW5xxvqb8gpflIdYc8+ucGFnZ5zKH20YzqHOlIg/jJOw3T/C1s8T/c6T4yxvhxxj/uxA==
quasar@2.6.6:
version "2.6.6"
resolved "https://registry.yarnpkg.com/quasar/-/quasar-2.6.6.tgz#00bc2acbe5ef2492f7b959f539fd2e469e7082a6"
integrity sha512-rXoGZROOXVutQX14l/ys0te/NrgQ754krI0Vz52pBXdznyS+dTL6AgGpr3JMwffoxpxhQyedrL2jOAMpq+Jsgw==
queue-microtask@^1.2.2:
version "1.2.3"

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save