mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-16 00:06:40 +01:00
b071de6742
Previously we hard deleted the users, but due to change requests and possibly other features in future, we really want to hard-link user table and have meaningful relationships. But this means, when user is deleted, all linked data is also deleted. **Workaround is to soft delete users and just clear users data and keep the relationships alive for audit logs.** This PR implements this feature.
20 lines
380 B
JavaScript
20 lines
380 B
JavaScript
'use strict';
|
|
|
|
exports.up = function (db, callback) {
|
|
db.runSql(
|
|
`
|
|
ALTER TABLE users ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMP WITH TIME ZONE;
|
|
`,
|
|
callback,
|
|
);
|
|
};
|
|
|
|
exports.down = function (db, callback) {
|
|
db.runSql(
|
|
`
|
|
ALTER TABLE users DROP COLUMN IF EXISTS deleted_at;
|
|
`,
|
|
callback,
|
|
);
|
|
};
|