View our GitHub

Please visit sails-docs on GitHub to view documentation on your mobile device.

Edit Page

sails.config.models

Your default project-wide model settings. Can also be overridden on a per-model basis by providing a top-level property with the same name in that model definition. For more details, see the conceptual docs on Model Settings. These options are conventionally specified in the config/models.js configuration file.

sails.config.models;

Properties

Property Type Default Details
attributes {} The basic pieces of information to store about a model. See Attributes.
migrate see Model Settings How & whether Sails will attempt to automatically rebuild the tables/collections/etc. in your schema
connection "localDiskDb" The default database connection any given model will use without a configured override
autoPK true Toggle the automatic definition of a primary key in your model
autoCreatedAt true Toggle the automatic definition of a property createdAt in your model
autoUpdatedAt true Toggle the automatic definition of a property updatedAt in your model
tableName identity Used to specify database table name for the model
dynamicFinders true Toggle the automatic creation of Dynamic Finders

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails-docs repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

We wrote a book!

Get early access to the book
with promotion code: mcneildoc

Get the Book