first commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
module.exports = (sequelize, DataTypes) => {
|
||||
const Conversation = sequelize.define('Conversation', {
|
||||
id: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true
|
||||
},
|
||||
user_id: {
|
||||
type: DataTypes.UUID,
|
||||
allowNull: false,
|
||||
references: {
|
||||
model: 'users',
|
||||
key: 'id'
|
||||
}
|
||||
},
|
||||
title: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.ENUM('active', 'completed', 'archived'),
|
||||
defaultValue: 'active'
|
||||
},
|
||||
context: {
|
||||
type: DataTypes.JSONB,
|
||||
defaultValue: {}
|
||||
},
|
||||
metadata: {
|
||||
type: DataTypes.JSONB,
|
||||
defaultValue: {}
|
||||
}
|
||||
}, {
|
||||
tableName: 'conversations',
|
||||
indexes: [
|
||||
{ fields: ['user_id'] },
|
||||
{ fields: ['status'] },
|
||||
{ fields: ['created_at'] }
|
||||
]
|
||||
});
|
||||
|
||||
return Conversation;
|
||||
};
|
||||
Reference in New Issue
Block a user