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

Commit fdf95ddd by Sushant Committed by GitHub

fixed #7735, sqlite memory url no longer works (#7736)

1 parent b7ca3c44
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
- [REMOVED] Removes support for interpretation of raw properties and values in the where object. [#7568](https://github.com/sequelize/sequelize/issues/7568) - [REMOVED] Removes support for interpretation of raw properties and values in the where object. [#7568](https://github.com/sequelize/sequelize/issues/7568)
- [FIXED] Upsert now updates all changed fields by default - [FIXED] Upsert now updates all changed fields by default
- [ADDED] Support for paths for sqlite databases via connection strings [#4721](https://github.com/sequelize/sequelize/issues/4721) - [ADDED] Support for paths for sqlite databases via connection strings [#4721](https://github.com/sequelize/sequelize/issues/4721)
- [FIXED] `sqlite://:memory:` no longer works [#7735](https://github.com/sequelize/sequelize/issues/7735)
## BC breaks: ## BC breaks:
- Model.validate instance method now runs validation hooks by default. Previously you needed to pass { hooks: true }. You can override this behavior by passing { hooks: false } - Model.validate instance method now runs validation hooks by default. Previously you needed to pass { hooks: true }. You can override this behavior by passing { hooks: false }
......
...@@ -111,7 +111,7 @@ class Sequelize { ...@@ -111,7 +111,7 @@ class Sequelize {
options.dialect = urlParts.protocol.replace(/:$/, ''); options.dialect = urlParts.protocol.replace(/:$/, '');
options.host = urlParts.hostname; options.host = urlParts.hostname;
if (options.dialect === 'sqlite' && urlParts.pathname) { if (options.dialect === 'sqlite' && urlParts.pathname && urlParts.pathname.indexOf('/:memory') !== 0) {
const path = Path.join(options.host, urlParts.pathname); const path = Path.join(options.host, urlParts.pathname);
options.storage = options.storage || path; options.storage = options.storage || path;
} }
......
...@@ -92,6 +92,16 @@ describe('Sequelize', () => { ...@@ -92,6 +92,16 @@ describe('Sequelize', () => {
expect(options.dialect).to.equal('sqlite'); expect(options.dialect).to.equal('sqlite');
expect(options.storage).to.equal('/completely/different/path.db'); expect(options.storage).to.equal('/completely/different/path.db');
}); });
it('should be able to use :memory:', () => {
const sequelize = new Sequelize('sqlite://:memory:');
const options = sequelize.options;
expect(options.dialect).to.equal('sqlite');
// empty host is treated as :memory:
expect(options.host).to.equal('');
expect(options.storage).to.equal(undefined);
});
} }
}); });
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!