Skip to content
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

Compatible 1.0 #18

Open
certifirm opened this issue Jul 5, 2018 · 3 comments
Open

Compatible 1.0 #18

certifirm opened this issue Jul 5, 2018 · 3 comments

Comments

@certifirm
Copy link

certifirm commented Jul 5, 2018

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

@bromine355
Copy link

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.

@certifirm
Copy link
Author

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.

@juliandavidmr
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants