Comments (7)
Yep you are right. I've chosen NOT NULL because it doesn't make any sense to have a boolean value with 3 states ^_^ The problem is, that you currently can't set default values. But I really have to implement that. If done, you will be able to just set the default for the boolean values. For now I would recommend to not allow NULL but to set a default :)
from sequelize.
I tried NULL with a default but couldn't get it to work. It created the table with the correct defaults but tried to set the booleans to NULL on insert/update... :/
from sequelize.
hey I just implemented default values and the possibility declare a field as non-null/null field.
please let me know if this works nicely :) I will change the documentation soon, but for now:
s.define("foobar", {
aBoolean: { type: Sequelize.BOOLEAN, allowNull: false, default: false },
aString: Sequelize.STRING
})
this will define the field aBoolean with the default of false and which is not allowed to save a null value
furthermore you will get a field aString which is just the normal varchar string :)
from sequelize.
if that works nicely i will push a new version 0.4 to github/npm
from sequelize.
and the documentation: http://sequelizejs.com/#basicMapping
from sequelize.
Very nice! Will try it out today.
from sequelize.
this seems to work :)
from sequelize.
Related Issues (20)
- Drop subclasses of `SequelizeConnectionError`
- Bug: the type of the `beforeBulkDestroy` hander's `options` attribute is `BulkCreateOptions` instead of `BulkDestroyOptions`
- bulkCreate with updateOnDuplicate updates the record (updatedAt) even if it is not changed HOT 3
- Is Iterate over findAll result and update records possible? HOT 3
- Creating multiple references in databases for same foreign key HOT 7
- postgres-array not resolved with yarn v4 (Error: Please install postgres-array package manually) HOT 2
- Customize toJSON() for custom serialization logic HOT 6
- Can't make table queries. TypeError: _.includes is not a function HOT 1
- DATE parse function crashes in SQLite HOT 1
- PostgreSQL. Error in getQueryInterface().describeTable() with column comments and schemas
- Unable to find dialect at HOT 2
- Cyclic sequelize sync doesn't handle several cases in the non-cyclic version HOT 1
- Introducing @EncryptedAttribute() decorator
- Add `Model.exists()` to allow efficient checking of at least one matching row
- Filter As on Properties of Associated Bs But Still Return all Bs Associated to the Resulting A's
- Feature Request: support 'schema' for MySQL HOT 1
- Merge Failure When Using Raw Where Query With Scope
- Recieving sqlite related errors, but dialect used is postgres
- An In-Class @Scope Decorator HOT 1
- Add method for accessing #transactionCls Sequelize v7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sequelize.