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

Commit 06703fbf by Mick Hansen

Merge pull request #4540 from overlookmotel/expose-association

Expose Association constructor as `Sequelize.Association`
2 parents 156c3dbe 3a44cd4e
# Next # Next
- [FIXED] Calling set with dot.separated key on a JSON/JSONB attribute will not flag the entire object as changed [#4379](https://github.com/sequelize/sequelize/pull/4379) - [FIXED] Calling set with dot.separated key on a JSON/JSONB attribute will not flag the entire object as changed [#4379](https://github.com/sequelize/sequelize/pull/4379)
- [ADDED] Expose Association constructor as `Sequelize.Association`
# 3.9.0 # 3.9.0
- [ADDED] beforeRestore/afterRestore hooks [#4371](https://github.com/sequelize/sequelize/issues/4371) - [ADDED] beforeRestore/afterRestore hooks [#4371](https://github.com/sequelize/sequelize/issues/4371)
......
'use strict';
var Association = require('./base');
Association.BelongsTo = require('./belongs-to');
Association.HasOne = require('./has-one');
Association.HasMany = require('./has-many');
Association.BelongsToMany = require('./belongs-to-many');
module.exports = Association;
...@@ -13,7 +13,8 @@ var url = require('url') ...@@ -13,7 +13,8 @@ var url = require('url')
, sequelizeErrors = require('./errors') , sequelizeErrors = require('./errors')
, Promise = require('./promise') , Promise = require('./promise')
, Hooks = require('./hooks') , Hooks = require('./hooks')
, Instance = require('./instance'); , Instance = require('./instance')
, Association = require('./associations/index');
/** /**
* This is the main class, the entry point to sequelize. To use it, you just need to import sequelize: * This is the main class, the entry point to sequelize. To use it, you just need to import sequelize:
...@@ -304,6 +305,13 @@ Sequelize.prototype.Deferrable = Sequelize.Deferrable = Deferrable; ...@@ -304,6 +305,13 @@ Sequelize.prototype.Deferrable = Sequelize.Deferrable = Deferrable;
Sequelize.prototype.Instance = Sequelize.Instance = Instance; Sequelize.prototype.Instance = Sequelize.Instance = Instance;
/** /**
* A reference to the sequelize association class.
* @property Association
* @see {Association}
*/
Sequelize.prototype.Association = Sequelize.Association = Association;
/**
* Allow hooks to be defined on Sequelize + on sequelize instance as universal hooks to run on all models * Allow hooks to be defined on Sequelize + on sequelize instance as universal hooks to run on all models
* and on Sequelize/sequelize methods e.g. Sequelize(), Sequelize#define() * and on Sequelize/sequelize methods e.g. Sequelize(), Sequelize#define()
*/ */
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!