Files
trash_system/backend/src/database/migrations/20222016014720-create-baileys-chats.ts
T
2025-10-13 00:23:31 -03:00

45 lines
1.0 KiB
TypeScript

import { QueryInterface, DataTypes } from "sequelize";
module.exports = {
up: (queryInterface: QueryInterface) => {
return queryInterface.createTable("BaileysChats", {
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true,
allowNull: false
},
whatsappId: {
type: DataTypes.INTEGER,
references: { model: "Whatsapps", key: "id" },
onUpdate: "CASCADE",
onDelete: "CASCADE"
},
jid: {
type: DataTypes.STRING,
allowNull: false
},
conversationTimestamp: {
type: DataTypes.STRING,
allowNull: false
},
unreadCount: {
type: DataTypes.INTEGER,
defaultValue: 0
},
createdAt: {
type: DataTypes.DATE,
allowNull: false
},
updatedAt: {
type: DataTypes.DATE,
allowNull: false
}
});
},
down: (queryInterface: QueryInterface) => {
return queryInterface.dropTable("BaileysChats");
}
};