简体   繁体   English

heroku服务器上postgres中的外键骆驼案例问题

[英]foreign key camel case issue in postgres on heroku server

i am creating table on heroku successfully but the problems is foreign key when add foreign key it will automatically created in small letter by default postgres accept foreign key like serviceId format我在heroku上成功创建表,但问题是外键添加外键时,默认情况下它将自动以小写字母创建postgres接受类似serviceId格式的外键

this is my table这是我的桌子

CREATE TABLE service_categories (
    id serial PRIMARY KEY,
    "serviceId"                 integer   NOT NULL,
    service_category_name       VARCHAR ( 50 )  NOT NULL,
    "createdAt"                 TIMESTAMP DEFAULT NOW(),
    "updatedAt"                 TIMESTAMP DEFAULT NOW()
);

but on heroku its created serviceid rather then serviceId any body can help how can i create foreign key like serviceId但是在heroku上它创建的serviceid而不是serviceId任何人都可以帮助我如何创建像serviceId这样的外键

just double quotes in the model like只是模型中的双引号,例如

const Order = db.define("my_orders", {
    id: {
        type: Sequelize.INTEGER,
        autoIncrement: true,
        allowNull: false,
        primaryKey: true,
    },
    "serviceSubCategoryId": {
        type: Sequelize.INTEGER
    },
   "userId": {
        type: Sequelize.INTEGER
    }
   
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM