sails-inverse-model
sails-inverse-model copied to clipboard
Compatible 1.0
With sails 1.0 and above, give a lot of error of column types, etc...
For example:
error: A hook (orm
) failed to load!
error: Failed to lift app: userError:
------------------------------------------
In the fechaalta
attribute of model tblclientes
:
The type "date" is no longer supported. To use this type in your model, change
type
to one of the supported types and set the columnType
property to a column
type supported by the model's adapter, e.g. { type: 'string', columnType: 'date' }
------------------------------------------
Is this repository deprecated?
Thanks
I am gussing this is no longer maintained, but I was able to get the npm package working for sails v1.0 easily but modifing the generator.
I am using mysql so /generator/mysql/compler_mysql.js
- Set attribute to id if primary
if (key_ === "PRI") { attrib = "id"; content_view.required = true; }
- Set columName attribute on each attribute
function getColumnName(attrib) { return "columnName: '" + attrib+"'"; }
- Comment out the size attribute (does sails v1 not use that anymore??)
//out.push("size: " + parseInt(attr_aux[1]));
I also camelized all the attributes but that just my preference. My database is snake case.
var result = { model_content: s.camelize(attrib).trim() + ": {" + attribute.join(',') + "}", view_content: JSON.stringify(content_view) };
In my opinion this package will save you a ton of time so it's totally worth fixing it.
It's a good start but the types are changed in Sails 1.0 and integer, ... must be 'number', and dates must be 'ref', etc... I think that I will do a fork of this repo with the changes because I need to port a lot of databases to sails and this is a very good repo.
Hello everyone, I appreciate that you want to contribute with this project, I think @jotae1e should have a fork of this repo since I do not have enough time to keep it updated.
Thanks @jotae1e @bromine355