1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-27 11:02:16 +01:00
unleash.unleash/src/migrations/20241105123918-add-cascade-for-user-unsubscription.js
Tymoteusz Czech 471cb796c9
migration(producitivty-report): cascade user unsubscription (#8655)
Remove opt-outs for deleted users. This is useful in tests, where we
delete users permanently.
2024-11-05 13:54:32 +01:00

17 lines
401 B
JavaScript

exports.up = function (db, cb) {
db.runSql(
`
ALTER TABLE user_unsubscription DROP CONSTRAINT user_unsubscription_user_id_fkey;
ALTER TABLE user_unsubscription
ADD CONSTRAINT user_unsubscription_user_id_fkey
FOREIGN KEY (user_id)
REFERENCES users(id) ON DELETE CASCADE;
`,
cb,
);
};
exports.down = function (db, cb) {
db.runSql('', cb);
};