tududi/backend/models/inbox_item.js
Chris 3c1209a5a9
Express migration (#80)
* Initial migration

* Cleanup and create migration scripts

* Introduce test suite

* Fix test issues

* Correct CORS issue and update paths

* Update README
2025-06-16 21:50:44 +03:00

42 lines
No EOL
788 B
JavaScript

const { DataTypes } = require('sequelize');
module.exports = (sequelize) => {
const InboxItem = sequelize.define('InboxItem', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
content: {
type: DataTypes.STRING,
allowNull: false
},
status: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: 'added'
},
source: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: 'tududi'
},
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'users',
key: 'id'
}
}
}, {
tableName: 'inbox_items',
indexes: [
{
fields: ['user_id']
}
]
});
return InboxItem;
};