File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ export class PeriodicDbDeleter {
65
65
for ( const i in rows ) {
66
66
const row = rows [ i ] ;
67
67
const whereClause = whereClauseFn ( row ) ;
68
- deletions . push ( `DELETE FROM ${ table . name } WHERE ${ whereClause } ;` ) ;
68
+ deletions . push ( `DELETE FROM ${ table . name } WHERE ${ whereClause } AND ${ deletionColumn } = true ;` ) ;
69
69
}
70
70
71
71
return result ;
Original file line number Diff line number Diff line change @@ -137,7 +137,12 @@ export class UserService {
137
137
if ( userUpdate ) {
138
138
userUpdate ( newUser ) ;
139
139
}
140
- newUser . identities . push ( identity ) ;
140
+ // HINT: we need to specify `deleted: false` here, so that any attempt to reuse the same
141
+ // entry would converge to a valid state. The identities are identified by the external
142
+ // `authId`, and if accounts are deleted, such entries are soft-deleted until the periodic
143
+ // deleter will take care of them. Reuse of soft-deleted entries would lead to an invalid
144
+ // state. This measure of prevention is considered in the period deleter as well.
145
+ newUser . identities . push ( { ...identity , deleted : false } ) ;
141
146
this . handleNewUser ( newUser , isFirstUser ) ;
142
147
newUser = await this . userDb . storeUser ( newUser ) ;
143
148
if ( token ) {
You can’t perform that action at this time.
0 commit comments