import { DataTypes } from 'sequelize';
export default (sequelize) => sequelize.define('user_project_roles', {
  upr_id:     { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
  user_id:    { type: DataTypes.INTEGER, allowNull: false },
  project_id: { type: DataTypes.INTEGER, allowNull: false },
  role_name:  { type: DataTypes.STRING(50), allowNull: false }, // Admin/Editor/Viewer/...
  created_at: { type: DataTypes.DATE },
  updated_at: { type: DataTypes.DATE },
}, { indexes: [{ unique:true, fields:['user_id','project_id','role_name'] }] });
