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

Commit 608f4774 by Mick Hansen

Don't fail on sqlite connection uris without a missing trailing slash

1 parent e528ac6c
Showing with 14 additions and 0 deletions
......@@ -56,7 +56,12 @@ module.exports = (function() {
if (arguments.length === 1 || (arguments.length === 2 && typeof username === 'object')) {
options = username || {}
urlParts = url.parse(arguments[0])
// SQLite don't have DB in connection url
if (urlParts.path) {
database = urlParts.path.replace(/^\//, '')
}
dialect = urlParts.protocol
options.dialect = urlParts.protocol.replace(/:$/, '')
options.host = urlParts.hostname
......
......@@ -40,6 +40,15 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
expect(sequelize.config.host).to.equal('127.0.0.1')
done()
})
if (dialect === 'sqlite') {
it('should work with connection strings (1)', function () {
var sequelize = new Sequelize('sqlite://test.sqlite')
})
it('should work with connection strings (2)', function () {
var sequelize = new Sequelize('sqlite://test.sqlite/')
})
}
})
if (dialect !== 'sqlite') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!