add user association with whatsapps

This commit is contained in:
Ricardo Paes
2022-02-23 11:06:31 -03:00
parent 504414496b
commit 67ad73a8bd
2 changed files with 28 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
import { QueryInterface, DataTypes } from "sequelize";
module.exports = {
up: (queryInterface: QueryInterface) => {
return queryInterface.addColumn("Users", "whatsappId", {
type: DataTypes.INTEGER,
references: { model: "Whatsapps", key: "id" },
onUpdate: "CASCADE",
onDelete: "SET NULL",
allowNull: true
},);
},
down: (queryInterface: QueryInterface) => {
return queryInterface.removeColumn("Users", "whatsappId");
}
};