-
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
where to add prefixes to tables? #203
Comments
You mean a generic prefix? |
for example. i have a range of test models in the same database. for the same model user, i can test different sets with the only need to change the prefix. for models.setPrefix("pre_"); models.define('user') if i use |
Ok, this can be an option. If I understood, you need something like: var orm = require("orm");
orm.connect("....", function (err, db) {
db.settings.set("models.namePrefix", "pre_"); // not sure the settings name is this
var Person1 = db.define("person", { // will use table "pre_person"
// ...
});
// ...
db.settings.unset("models.namePrefix");
var Person2 = db.define("person", { // will use table "person"
// ...
});
}); |
yes, it works now? |
No but I'll do it :) |
When set, is the prefix for subsequent db.define() table names (if no table or collection is passed in options)
The setting name is actually |
great! but after npm update, it seems the package not updated yet. |
Yes, I need to close some things before publishing a new version. For now you might want to try: npm install dresende/node-orm2 It should fetch directly from github. |
thanks, i will wait for your update:) |
where to add prefixes to tables?
The text was updated successfully, but these errors were encountered: