Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- module.exports = function(sequelize, DataTypes) {
- var User = sequelize.define('User', {
- user_id:{
- type: DataTypes.INTEGER,
- primaryKey: true,
- autoIncrement: true
- },
- name: {
- type: DataTypes.STRING,
- allowNull: false
- },
- lastname: {
- type: DataTypes.STRING,
- allowNull: false
- },
- email: {
- type: DataTypes.STRING,
- unique: true
- },
- password: {
- type: DataTypes.STRING,
- allowNull: false
- },
- phone:{
- type: DataTypes.INTEGER,
- unique: true,
- allowNull: false
- },
- paymentInfo: {
- type: DataTypes.STRING,
- allowNull: true
- }
- }, {
- classMethods: {
- associate: function(models) {
- // associations can be defined here
- User.hasMany(models.Group, {
- as: 'groups',
- foreignKey: 'group_id'
- }),
- User.hasMany(models.Friendship, {
- as: 'friends',
- foreignKey: 'friend_id'
- })
- }
- }
- });
- return User;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement