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

Does -c option works well #6

Closed
dimitroffs opened this issue Sep 29, 2014 · 5 comments
Closed

Does -c option works well #6

dimitroffs opened this issue Sep 29, 2014 · 5 comments

Comments

@dimitroffs
Copy link

Hello guys,

I'm just curious how can I set default options for every model object e.g.

{
"timestamps" : false,
"freezeTableName": true
}

I tried this as config file, but it doesn't include this information in model files

Thanks in advance

@from-nibly
Copy link
Contributor

the config file with -c adds to the sequelize connection object. I forked this repo and am currently requesting a pull. You can use the -a tag or put it in the -c file under the object additional. Let me know if you have problems

here is an example of the config file.

{
    "aditional" :{
      "timestamps": false,
      "freezeTableName": true
    }
}

then just use -c or --config to point at the file containing this json.

NOTE this has not been merged into master and is thus subject to major change. i wouldn't depend on this in production.

@johnraber
Copy link

Any plans to merge this in? Thx for the hard work

@edision
Copy link

edision commented Sep 5, 2015

I modified the source code in npm install path;
/bin/sequlize-auto line 34

configFile.host = argv.h || configFile.host || 'localhost';
configFile.aditional = configFile.aditional || null; 

/lib/index.js line 143

...
});
            text[table] += spaces + "}";
            // add aditional options here
            if (self.sequelize.options.aditional !== null) {
              text[table] += ",{\n";
              var aditional = self.sequelize.options.aditional;
              var propertyNames = Object.getOwnPropertyNames(aditional);
              var props = "";
              propertyNames.forEach(function (p) {
                props += spaces + spaces + spaces + p + ": " + aditional[p] + ",\n"
              }, this);
              props = props.substr(0, props.length - 2);

              text[table] += props + "\n  }";
            }

            text[table] += ");\n};\n";
          _callback(null);

it works! ^_^

@from-nibly
Copy link
Contributor

i would love to merge it in. just need to sit down and figure out why they are rejecting it.

@durango
Copy link
Member

durango commented Oct 6, 2015

It's been merged, closing this comment thanks @from-nibly !

@durango durango closed this as completed Oct 6, 2015
anjnkmr added a commit to realvariabledas/sequelize-auto that referenced this issue Nov 1, 2019
anjnkmr added a commit to realvariabledas/sequelize-auto that referenced this issue Nov 15, 2019
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

5 participants