Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- module.exports = function(sequelize, DataTypes){
- //Define the user table, and its columns, data types, attributes
- var User = sequelize.define('User', {
- user_id: {...},
- user_name: {...}
- },
- {
- //Define the constraints, such as foreign key
- classMethods:{
- associate: function(models){
- User.belongsToMany(models.Group),
- User.hasMany(models.Old_Password),
- }
- }
- });
- return User;
- };
- 'use strict';
- module.exports = function(sequelize, DataTypes){
- var Role = sequelize.define('Role',{
- role_id: {...},
- role_name:{...}
- },
- {
- //Define the constraints, such as foreign key
- classMethods:{
- associate: function(models){
- Role.belongsTo(models.User)
- }
- }
- });
- return Role;
- };
- var Group = connection.define('group', {
- group_id: {...},
- group_name: {...},
- }
- return Group;
- };
- 'use strict';
- module.exports = function(sequelize, DataTypes){
- //Define the table, and its columns, data types, attributes
- var Old_Password = connection.define('Old_Password', {
- old_password_id: {...},
- old_password_value: {...}
- },
- {
- //Define the constraints, such as foreign key
- classMethods:{
- associate: function(models){
- Old_Password.hasOne(models.User)
- }
- }
- });
- return Old_Password;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement