不要怂,就是干,撸起袖子干!

Commit fd426d7c by Jan Aagaard Meier

bug(postgres) Fall back to latest version if parsing db version fails. Closes #4368

1 parent 45775541
# Next
- [FIXED] Fall back to a default version when parsing the DB version fails [#4368](https://github.com/sequelize/sequelize/issues/4368)
# 3.6.0 # 3.6.0
- [ADDED] Model.findCreateFind: A more performant findOrCreate that will not work under a transaction (atleast not in postgres) - [ADDED] Model.findCreateFind: A more performant findOrCreate that will not work under a transaction (atleast not in postgres)
- [FIXED] Show indexes query on Postgres fails to return functional indexes [#3911](https://github.com/sequelize/sequelize/issues/3911) - [FIXED] Show indexes query on Postgres fails to return functional indexes [#3911](https://github.com/sequelize/sequelize/issues/3911)
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
var Pooling = require('generic-pool') var Pooling = require('generic-pool')
, Promise = require('../../promise') , Promise = require('../../promise')
, _ = require('lodash') , _ = require('lodash')
, semver = require('semver')
, defaultPoolingConfig = { , defaultPoolingConfig = {
max: 5, max: 5,
min: 0, min: 0,
...@@ -196,7 +197,8 @@ ConnectionManager.prototype.getConnection = function(options) { ...@@ -196,7 +197,8 @@ ConnectionManager.prototype.getConnection = function(options) {
_options.logging.__testLoggingFn = true; _options.logging.__testLoggingFn = true;
return self.sequelize.databaseVersion(_options).then(function (version) { return self.sequelize.databaseVersion(_options).then(function (version) {
self.sequelize.options.databaseVersion = version; self.sequelize.options.databaseVersion = semver.valid(version) ? version : self.defaultVersion;
self.versionPromise = undefined; self.versionPromise = undefined;
self.$disconnect(connection); self.$disconnect(connection);
...@@ -216,6 +218,7 @@ ConnectionManager.prototype.getConnection = function(options) { ...@@ -216,6 +218,7 @@ ConnectionManager.prototype.getConnection = function(options) {
}); });
}); });
}; };
ConnectionManager.prototype.releaseConnection = function(connection) { ConnectionManager.prototype.releaseConnection = function(connection) {
var self = this; var self = this;
......
...@@ -36,6 +36,7 @@ MysqlDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.support ...@@ -36,6 +36,7 @@ MysqlDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.support
GEOMETRY: true GEOMETRY: true
}); });
ConnectionManager.prototype.defaultVersion = '5.6.0';
MysqlDialect.prototype.Query = Query; MysqlDialect.prototype.Query = Query;
MysqlDialect.prototype.QueryGenerator = QueryGenerator; MysqlDialect.prototype.QueryGenerator = QueryGenerator;
MysqlDialect.prototype.DataTypes = DataTypes; MysqlDialect.prototype.DataTypes = DataTypes;
......
...@@ -49,6 +49,7 @@ PostgresDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.supp ...@@ -49,6 +49,7 @@ PostgresDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.supp
deferrableConstraints: true deferrableConstraints: true
}); });
ConnectionManager.prototype.defaultVersion = '9.4.0';
PostgresDialect.prototype.Query = Query; PostgresDialect.prototype.Query = Query;
PostgresDialect.prototype.DataTypes = DataTypes; PostgresDialect.prototype.DataTypes = DataTypes;
PostgresDialect.prototype.name = 'postgres'; PostgresDialect.prototype.name = 'postgres';
......
...@@ -29,6 +29,7 @@ SqliteDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.suppor ...@@ -29,6 +29,7 @@ SqliteDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.suppor
groupedLimit: false groupedLimit: false
}); });
ConnectionManager.prototype.defaultVersion = '3.8.0';
SqliteDialect.prototype.Query = Query; SqliteDialect.prototype.Query = Query;
SqliteDialect.prototype.DataTypes = DataTypes; SqliteDialect.prototype.DataTypes = DataTypes;
SqliteDialect.prototype.name = 'sqlite'; SqliteDialect.prototype.name = 'sqlite';
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!