sails-inverse-model icon indicating copy to clipboard operation
sails-inverse-model copied to clipboard

Compatible 1.0

Open certifirm opened this issue 6 years ago • 3 comments

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

certifirm avatar Jul 05 '18 18:07 certifirm

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

  1. Set attribute to id if primary if (key_ === "PRI") { attrib = "id"; content_view.required = true; }
  2. Set columName attribute on each attribute function getColumnName(attrib) { return "columnName: '" + attrib+"'"; }
  3. 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.

bromine355 avatar Sep 07 '18 23:09 bromine355

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.

certifirm avatar Sep 13 '18 09:09 certifirm

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

juliandavidmr avatar Sep 13 '18 14:09 juliandavidmr