不同的架构模型关联Sequelize.js和MySQL
我有两个MYSQL模式,他们必须一起工作。
IE:“user”表位于模式“a”中,“profile”表位于模式“b”中。
-
configuration文件 – >有很多用户
-
用户 – >属于configuration文件
在Sequelize js中通过这种方式定义以不同模式生活的两个模型之间的关联是否可行?
// after define the models .. Profile.hasMany(User); User.belongsTo(Profile); // get the profile of the user(from the b schema) User.find(1).success( function(user) { console.log(user.getProfile()); });
这将工作?
我应该如何定义不同模式的模型?