创建与现有表的关联

时间:2019-03-07 16:27:33

标签: sequelize.js

我有一个用户表,该表从我们的身份提供商 Auth0 获取信息。

如何使用Sequelize关联与我的联系表建立一对一关系。

示例:“联系人”表

module.exports = (sequelize, Sequelize) => {
    const Contacts = sequelize.define('profile_contacts', {
        ID: {
            type: Sequelize.INTEGER,
            primaryKey: true,
            autoIncrement: true
        },
        phone: {
            type: Sequelize.STRING
        },
        linkedin_profile: {
            type: Sequelize.STRING
        }
    },
    {
        timestamps: false
    });

    return Contacts;
}

0 个答案:

没有答案