Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit ba2b2600
authored
Aug 27, 2015
by
Alessandro Zanardi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added details about "unique" property (closes #4329)
1 parent
81063c12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
docs/docs/models-definition.md
docs/docs/models-definition.md
View file @
ba2b260
...
@@ -37,6 +37,12 @@ var Foo = sequelize.define('Foo', {
...
@@ -37,6 +37,12 @@ var Foo = sequelize.define('Foo', {
someUnique
:
{
type
:
Sequelize
.
STRING
,
unique
:
true
},
someUnique
:
{
type
:
Sequelize
.
STRING
,
unique
:
true
},
uniqueOne
:
{
type
:
Sequelize
.
STRING
,
unique
:
'compositeIndex'
},
uniqueOne
:
{
type
:
Sequelize
.
STRING
,
unique
:
'compositeIndex'
},
uniqueTwo
:
{
type
:
Sequelize
.
INTEGER
,
unique
:
'compositeIndex'
}
uniqueTwo
:
{
type
:
Sequelize
.
INTEGER
,
unique
:
'compositeIndex'
}
// The unique property is simply a shorthand to create a unique index.
someUnique
:
{
type
:
Sequelize
.
STRING
,
unique
:
true
}
// It's exactly the same as creating the index in the model's options.
{
someUnique
:
{
type
:
Sequelize
.
STRING
}},
{
indexes
:
[{
unique
:
true
,
fields
:
[
'someUnique'
]}]}
// Go on reading for further information about primary keys
// Go on reading for further information about primary keys
identifier
:
{
type
:
Sequelize
.
STRING
,
primaryKey
:
true
},
identifier
:
{
type
:
Sequelize
.
STRING
,
primaryKey
:
true
},
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment