Unverified Commit 7b060bec authored by NGPixel's avatar NGPixel

fix: db connection

parent 3a57145e
......@@ -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
// ------------------------------------------------------------------
......
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment