mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-10 03:33:48 +00:00
47268c738a
# Which Problems Are Solved When downgrading zitadel and upgrading it again, it might be that orgs deleted in this period still have stale entries in the fields table. # How the Problems Are Solved - Make the cleanup repeatable - Scope the query by instance so that an index is used. (cherry picked from commit da706a8b30dca5ab4d7d96ae4225dcc9d55d85a5)
10 lines
214 B
SQL
10 lines
214 B
SQL
DELETE FROM eventstore.fields
|
|
WHERE aggregate_type = 'org'
|
|
AND aggregate_id IN (
|
|
SELECT aggregate_id
|
|
FROM eventstore.events2
|
|
WHERE instance_id = $1
|
|
AND aggregate_type = 'org'
|
|
AND event_type = 'org.removed'
|
|
);
|