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

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
- [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)
......
......@@ -3,6 +3,7 @@
var Pooling = require('generic-pool')
, Promise = require('../../promise')
, _ = require('lodash')
, semver = require('semver')
, defaultPoolingConfig = {
max: 5,
min: 0,
......@@ -196,7 +197,8 @@ ConnectionManager.prototype.getConnection = function(options) {
_options.logging.__testLoggingFn = true;
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.$disconnect(connection);
......@@ -216,6 +218,7 @@ ConnectionManager.prototype.getConnection = function(options) {
});
});
};
ConnectionManager.prototype.releaseConnection = function(connection) {
var self = this;
......
......@@ -36,6 +36,7 @@ MysqlDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.support
GEOMETRY: true
});
ConnectionManager.prototype.defaultVersion = '5.6.0';
MysqlDialect.prototype.Query = Query;
MysqlDialect.prototype.QueryGenerator = QueryGenerator;
MysqlDialect.prototype.DataTypes = DataTypes;
......
......@@ -49,6 +49,7 @@ PostgresDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.supp
deferrableConstraints: true
});
ConnectionManager.prototype.defaultVersion = '9.4.0';
PostgresDialect.prototype.Query = Query;
PostgresDialect.prototype.DataTypes = DataTypes;
PostgresDialect.prototype.name = 'postgres';
......
......@@ -29,6 +29,7 @@ SqliteDialect.prototype.supports = _.merge(_.cloneDeep(Abstract.prototype.suppor
groupedLimit: false
});
ConnectionManager.prototype.defaultVersion = '3.8.0';
SqliteDialect.prototype.Query = Query;
SqliteDialect.prototype.DataTypes = DataTypes;
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!