-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mysql: not null / required column #110
Comments
There isn't yet, I'll work on it. |
Get the latest git version and try this (adjust to your code): orm.settings.set("properties.not_null", true); // changes default to NOT NULL
orm.connect("mysql://....", function (err, db) {
var Person = db.define('person', {
name : String
});
Person.sync();
// ...
}); |
ok your very fast. Thanks for all your help.... The next problem is existing tables... how to add null? And what about validation... it would be great if this was also default handled (you cant create an item anyway...) |
Existing tables are more hard to handle but it's in the plans (#103). For validations look at the first example in the Readme. I know the documentation is scarse but I tend to code more and document less. |
Probably just nitpicking, but could we call this setting 'required' just like we have on has one associations? It does the same thing. I'm also thinking that 'notnull' may not make sense for non-sql datastores. 'required' is more general. |
Agree |
How to define an required column in a model. In Mysql I define a column with
CREATE TABLE
test
(testcol
varchar(45) NOT NULL,Not sure how to define this in Orm2
The text was updated successfully, but these errors were encountered: