-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
How to eliminate the "id" field on table creation and select? Postgres #7945
Comments
codeimmortal
changed the title
How to eliminate the "id" field on table creation and select?
How to eliminate the "id" field on table creation and select? Postgres
Jul 13, 2017
You can remove the attribute by calling: blurbs.removeAttribute('id'); Right after you have defined |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂 |
The solution worked. |
Any fancier solution so far? |
Duplicate of #3142 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when i am creating any table by sequlizer it is adding id with it . I want to to be removed.
/*global sequelize Sequelize */
module.exports = (function () {
'use strict';
var blurbs = sequelize.define('blurb', {
blurb_id: {
type: Sequelize.INTEGER
},
update_date: {
type: Sequelize.DATE
}
},
{
freezeTableName: true,
schema: 'mobile_blurb',// don't add the timestamp attributes (updatedAt, createdAt)
timestamps: false
// ,id: false
});
// // force: true will drop the table if it already exists
blurbs.sync({force: false}).then(function () {
// Table created
return true;
});
return blurbs;
}());
**The query is generated is this .
CREATE TABLE IF NOT EXISTS "mobile_blurb"."blurb" ("id" S
ERIAL , "blurb_id" INTEGER, "update_date" TIMESTAMP WITH TIME ZONE, PRIMARY KEY
("id"));
I don't need "id" field.**
The text was updated successfully, but these errors were encountered: