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

Commit 380a64e7 by Sascha Depold

Merge branch 'master' of github.com:sdepold/sequelize

2 parents 6343ebb9 c05f7acc
...@@ -4,3 +4,4 @@ test*.js ...@@ -4,3 +4,4 @@ test*.js
.DS_STORE .DS_STORE
node_modules node_modules
npm-debug.log npm-debug.log
*~
...@@ -19,6 +19,33 @@ The Sequelize library provides easy access to MySQL, SQLite or PostgreSQL databa ...@@ -19,6 +19,33 @@ The Sequelize library provides easy access to MySQL, SQLite or PostgreSQL databa
- Associations - Associations
- Importing definitions from single files - Importing definitions from single files
## Roadmap
A very basic roadmap. Chances aren't too bad, that not mentioned things are implemented as well. Don't panic :)
### 1.6.0 (ToDo)
- Fix last issues with eager loading of associated data
- Find out why Person.belongsTo(House) would add person_id to house. It should add house_id to person
### 1.7.0
- Transactions
- Support for update of tables without primary key
- MariaDB support
- Support for update and delete calls for whole tables without previous loading of instances
- Eager loading of nested associations [#388](https://github.com/sdepold/sequelize/issues/388#issuecomment-12019099)
### 1.7.x
- Complete support for non-id primary keys
### 1.8.0
- API sugar (like Model.select().where().group().include().all())
- Schema dumping
- enum support
- attributes / values of a dao instance should be scoped
### 2.0.0
- save datetimes in UTC
## Documentation, Examples and Updates ## ## Documentation, Examples and Updates ##
You can find the documentation and announcements of updates on the [project's website](http://www.sequelizejs.com). You can find the documentation and announcements of updates on the [project's website](http://www.sequelizejs.com).
......
...@@ -93,7 +93,9 @@ module.exports = (function() { ...@@ -93,7 +93,9 @@ module.exports = (function() {
callback && callback(null, result) callback && callback(null, result)
} }
var migrationFiles = fs.readdirSync(this.options.path) var migrationFiles = fs.readdirSync(this.options.path).filter(function(file) {
return /\.js$/.test(file)
})
var migrations = migrationFiles.map(function(file) { var migrations = migrationFiles.map(function(file) {
return new Migration(self, self.options.path + '/' + file) return new Migration(self, self.options.path + '/' + file)
......
...@@ -47,10 +47,7 @@ var Utils = module.exports = { ...@@ -47,10 +47,7 @@ var Utils = module.exports = {
return connection.escape(s).replace(/\\"/g, '"') return connection.escape(s).replace(/\\"/g, '"')
}, },
format: function(arr) { format: function(arr) {
var query = arr[0] return connection.format.apply(connection, [arr.shift(), arr])
, replacements = Utils._.compact(arr.map(function(obj) { return obj != query ? obj : null}))
return connection.format.apply(connection, [query, replacements])
}, },
isHash: function(obj) { isHash: function(obj) {
return Utils._.isObject(obj) && !Utils._.isArray(obj); return Utils._.isObject(obj) && !Utils._.isArray(obj);
......
...@@ -112,4 +112,16 @@ describe('Utils', function() { ...@@ -112,4 +112,16 @@ describe('Utils', function() {
expect(Utils.isHash(values)).toBeTruthy(); expect(Utils.isHash(values)).toBeTruthy();
}); });
}); });
describe('format', function() {
it('should format where clause correctly when the value is truthy', function() {
var where = ['foo = ?', 1];
expect(Utils.format(where)).toEqual('foo = 1');
});
it('should format where clause correctly when the value is falsy', function() {
var where = ['foo = ?', 0];
expect(Utils.format(where)).toEqual('foo = 0');
});
});
}) })
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!