Add missing team->user constraint (#4411)
* Add missing team->user constraint * fix: teamPermanentDeleter cannot complete when team has domains
This commit is contained in:
@@ -175,13 +175,6 @@ async function teamPermanentDeleter(team: Team) {
|
|||||||
force: true,
|
force: true,
|
||||||
transaction,
|
transaction,
|
||||||
});
|
});
|
||||||
await User.destroy({
|
|
||||||
where: {
|
|
||||||
teamId,
|
|
||||||
},
|
|
||||||
force: true,
|
|
||||||
transaction,
|
|
||||||
});
|
|
||||||
await team.destroy({
|
await team.destroy({
|
||||||
force: true,
|
force: true,
|
||||||
transaction,
|
transaction,
|
||||||
|
|||||||
19
server/migrations/20221111171828-fix-user-constraints.js
Normal file
19
server/migrations/20221111171828-fix-user-constraints.js
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
up: async (queryInterface, Sequelize) => {
|
||||||
|
await queryInterface.changeColumn("users", "teamId", {
|
||||||
|
type: Sequelize.UUID,
|
||||||
|
onDelete: "cascade",
|
||||||
|
references: {
|
||||||
|
model: "teams",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
down: async (queryInterface, Sequelize) => {
|
||||||
|
await queryInterface.changeColumn("users", "teamId", {
|
||||||
|
type: Sequelize.UUID,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user