Compare commits
1 Commits
f/clean_au
...
680d879d03
Author | SHA1 | Date | |
---|---|---|---|
680d879d03 |
@@ -69,8 +69,6 @@ where table_schema = 'public'
|
||||
order by 4 desc;
|
||||
EOF
|
||||
|
||||
### Flow table
|
||||
|
||||
log "Cleaning flow table..."
|
||||
|
||||
REMAINING_ELMTS="${LIMIT}"
|
||||
@@ -107,8 +105,6 @@ EOF
|
||||
fi
|
||||
done
|
||||
|
||||
### Authentication session table
|
||||
|
||||
log "Cleaning authentication_session table..."
|
||||
|
||||
BATCH_SIZE="${BATCH_SIZE_ORIG}"
|
||||
@@ -138,15 +134,15 @@ log "${OUTPUT}"
|
||||
while [ "${REMAINING_ELMTS}" -gt 0 ]; do
|
||||
|
||||
OUTPUT=$(psql "${DSN}" <<EOF
|
||||
WITH childless_auth_session_batch AS (
|
||||
WITH cte AS (
|
||||
SELECT id
|
||||
FROM hydra_cleaner.hydra_childless_auth_session
|
||||
LIMIT ${BATCH_SIZE}
|
||||
),
|
||||
auth_session_deleted AS (
|
||||
auth_session_deleted as (
|
||||
DELETE
|
||||
FROM hydra_oauth2_authentication_session
|
||||
WHERE hydra_oauth2_authentication_session.id IN (SELECT * FROM childless_auth_session_batch)
|
||||
WHERE hydra_oauth2_authentication_session.id in (select * from cte)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM hydra_oauth2_flow
|
||||
@@ -155,7 +151,7 @@ auth_session_deleted AS (
|
||||
)
|
||||
DELETE
|
||||
FROM hydra_cleaner.hydra_childless_auth_session
|
||||
WHERE hydra_cleaner.hydra_childless_auth_session.id IN (SELECT * FROM childless_auth_session_batch);
|
||||
WHERE hydra_cleaner.hydra_childless_auth_session.id in (select * from cte);
|
||||
EOF
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user