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

Commit 7e9679be by Jan Aagaard Meier

Docs for sequelize.models

1 parent 912e1b1a
Showing with 11 additions and 3 deletions
......@@ -162,6 +162,11 @@ module.exports = (function() {
} catch(err) {
throw new Error("The dialect " + this.getDialect() + " is not supported.")
}
/**
* Models are stored here under the name given to `sequelize.define`
* @property models
*/
this.models = {}
this.modelManager = this.daoFactoryManager = new ModelManager(this)
this.transactionManager = new TransactionManager(this)
......@@ -275,7 +280,7 @@ module.exports = (function() {
* The table columns are define by the hash that is given as the second argument. Each attribute of the hash represents a column. A short table definition might look like this:
*
* ```js
* sequelize.define(..., {
* sequelize.define('modelName', {
* columnA: {
* type: Sequelize.BOOLEAN,
* validate: {
......@@ -292,7 +297,10 @@ module.exports = (function() {
* columnB: Sequelize.STRING,
* columnC: 'MY VERY OWN COLUMN TYPE'
* })
* ```
*
* sequelize.models.modelName // The model will now be available in models under the name given to define
* ```
*
*
* As shown above, column definitions can be either strings, a reference to one of the datatypes that are predefined on the Sequelize constructor, or an object that allows you to specify both the type of the column, and other attributes such as default values, foreign key constraints and custom setters and getters.
*
......@@ -306,7 +314,7 @@ module.exports = (function() {
*
* @see {DataTypes}
* @see {Hooks}
* @param {String} daoName
* @param {String} daoName The name of the model. The model will be stored in `sequelize.models` under this name
* @param {Object} attributes An object, where each attribute is a column of the table. Each column can be either a DataType, a string or a type-description object, with the properties described below:
* @param {String|DataType|Object} attributes.column The description of a database column
* @param {String|DataType} attributes.column.type A string or a data type
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!