Permalink
Browse files

moved source files

  • Loading branch information...
1 parent 0fbfa63 commit 005941840a2363fba749c0ae167616bc9c6853c3 @sdepold committed Nov 7, 2011
@@ -1,66 +0,0 @@
-var Sequelize = require(__dirname + "/../../lib/sequelize/Sequelize").Sequelize,
- sequelize = new Sequelize("sequelize_test", "root", null, {disableLogging: false})
-
-var Person = sequelize.define('person', {
- name: Sequelize.STRING
-})
-
-var Pet = sequelize.define('pet', {
- name: Sequelize.STRING
-})
-
-Person.hasManyAndBelongsTo('pets', Pet, 'owner')
-
-Sequelize.chainQueries([{drop: sequelize}, {sync: sequelize}], function() {
- var person = new Person({ name: 'Luke' }),
- pet1 = new Pet({ name: 'Bob' }),
- pet2 = new Pet({ name: 'Aaron' })
-
- Sequelize.chainQueries([{save: person}, {save: pet1}, {save: pet2}], function() {
- person.setPets([pet1], function(pets) {
-
- Sequelize.Helper.log('my pet: ' + pets[0].name )
- Sequelize.Helper.log("Now let's get the same data with fetchData!")
-
- person.fetchAssociations(function(data) {
- Sequelize.Helper.log("And here we are: " + data.pets[0].name)
- Sequelize.Helper.log("The object should now also contain the data: " + person.fetchedAssociations.pets[0].name)
-
- Sequelize.Helper.log('This won\'t do a database request!')
- person.getPets(function(pets) {
-
- Sequelize.Helper.log("Pets: " + pets.map(function(pet) { return pet.name }).join(", "))
- Sequelize.Helper.log("Let's associate with another pet...")
-
- person.setPets([pet1, pet2], function() {
-
- Sequelize.Helper.log("The set call has stored the pets as associated data!")
- Sequelize.Helper.log("And now let's find the pets again! This will make no new database request but serve the already stored pets Bob and Aaron!")
-
- person.getPets(function(pets) {
-
- Sequelize.Helper.log("Pets: " + pets.map(function(pet) { return pet.name }).join(", "))
- Sequelize.Helper.log("Now let's force the reloading of pets!")
-
- person.getPets({refetchAssociations: true}, function(pets) {
-
- Sequelize.Helper.log("Pets: " + pets.map(function(pet) { return pet.name }).join(", "))
-
- Person.find(person.id, { fetchAssociations: true }, function(p) {
- var petNames = p.fetchedAssociations.pets.map(function(pet) { return pet.name }).join(", ")
- Sequelize.Helper.log('Works with find as well: ' + petNames)
- })
-
- Person.findAll({ fetchAssociations: true }, function(people) {
- var petNames = people[0].fetchedAssociations.pets.map(function(pet) { return pet.name }).join(", ")
- Sequelize.Helper.log('And also with findAll: ' + petNames)
- })
-
- })
- })
- })
- })
- })
- })
- })
-})
View
@@ -1 +1 @@
-module.exports = require("./lib/sequelize/sequelize")
+module.exports = require("./lib/sequelize")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -2,7 +2,7 @@ var config = require("./config/config")
, Sequelize = require("../index")
, sequelize = new Sequelize(config.database, config.username, config.password, { logging: false })
, Helpers = new (require("./config/helpers"))(sequelize)
- , QueryGenerator = require("../lib/sequelize/query-generator")
+ , QueryGenerator = require("../lib/query-generator")
describe('QueryGenerator', function() {
beforeEach(function() { Helpers.sync() })
View
@@ -1,10 +1,10 @@
var assert = require("assert")
- , ModelDefinition = require("./../../lib/sequelize/model-definition")
+ , ModelDefinition = require("./../../lib/model-definition")
module.exports = {
'mixin should be correctly added to the model': function() {
assert.isDefined(ModelDefinition.prototype.hasOne)
assert.isDefined(ModelDefinition.prototype.hasMany)
assert.isDefined(ModelDefinition.prototype.belongsTo)
}
-}
+}
@@ -1,5 +1,5 @@
var assert = require("assert")
- , QueryGenerator = require("../../lib/sequelize/query-generator")
+ , QueryGenerator = require("../../lib/query-generator")
, eql = assert.equal
module.exports = {
@@ -1,5 +1,5 @@
var assert = require("assert")
- , Utils = require("../../lib/sequelize/utils")
+ , Utils = require("../../lib/utils")
module.exports = {
'it should be false if primaryKeys and args have different lengths': function() {
@@ -14,4 +14,4 @@ module.exports = {
'it should be true if primaryKeys are dates and lengths are matching': function() {
assert.eql(true, Utils.argsArePrimaryKeys([new Date()], ['foo']))
}
-}
+}
View
@@ -1,5 +1,5 @@
var assert = require("assert")
- , Utils = require("../../lib/sequelize/utils")
+ , Utils = require("../../lib/utils")
module.exports = {
'underscoredIf should be defined': function() {
@@ -16,4 +16,4 @@ module.exports = {
assert.eql(Utils._.camelizeIf('foo_bar', false), 'foo_bar')
assert.eql(Utils._.camelizeIf('foo_bar', true), 'fooBar')
}
-}
+}

0 comments on commit 0059418

Please sign in to comment.