sequelize-singleton
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -19,2 +19,5 @@ "use strict"; | ||
if(db.logger) | ||
console.log("Connecting to: " + database + " as: " + username); | ||
// Instanciate a new sequelize instance | ||
@@ -44,2 +47,6 @@ var sequelize = new db.Sequelize(database, username, password, options); | ||
Object.keys(db.models).forEach(function(modelName) { | ||
if(db.logger) | ||
console.log("Associating Model: "+ modelName); | ||
if ("associate" in db.models[modelName]) { | ||
@@ -54,2 +61,5 @@ db.models[modelName].associate(db.models); | ||
if(db.logger) | ||
console.log("Finished Connecting"); | ||
return true; | ||
@@ -56,0 +66,0 @@ }; |
{ | ||
"name": "sequelize-singleton", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"author": "Jacob Spizziri <jacob.spizziri@gmail.com> (https://github.com/jspizziri)", | ||
@@ -20,6 +20,6 @@ "license": "BSD-2-Clause", | ||
], | ||
"dependencies": { | ||
"mysql": "^2.5.4", | ||
"dependencies" : {}, | ||
"peerDependencies": { | ||
"sequelize": "^2.0.0-rc8" | ||
} | ||
} |
@@ -12,3 +12,3 @@ # sequelize-singleton | ||
The sequelize-singleton ```connect()``` argument accepts the same parameters as the Sequelize() object. It is important to configure the ```discover``` array of the set of paths where your models should be discovered. | ||
The sequelize-singleton ```connect()``` method accepts the same parameters as the Sequelize() object ```database, username, password, options```. It is important to configure the ```discover``` array of the set of paths where your models should be discovered. | ||
``` | ||
@@ -28,7 +28,9 @@ // app.js | ||
``` | ||
Upon ```connect()``` sequelize-singleton will SYNCHRONOUSLY recurse through the provided file paths looking for any files with the naming convention ```*.model.js```. | ||
Upon ```connect()``` sequelize-singleton will ***SYNCHRONOUSLY recurse*** through all of the subfolders located at the provided file paths looking for any files with the naming default convention ```*.model.js```. | ||
## Custom matcher | ||
Alternatively you can define a custom matching function which returns a ```boolean``` and attach it to: | ||
If you prefer to define your own naming convention instead of the default you can create a custom matching function which receives the file name as the parameter returns a ```boolean``` indicating if sequelize-singleton should attempt to load the file as a model. | ||
This function should be attached to ```matcher``` like so: | ||
``` | ||
@@ -35,0 +37,0 @@ orm.matcher = function(file){ |
5666
1
64
79
- Removedmysql@^2.5.4
- Removedsequelize@^2.0.0-rc8
- Removedbignumber.js@9.0.0(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedmysql@2.18.1(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.7(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedsqlstring@2.3.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)