finalize-ingress-reject-cleanup.sql 844 B

1234567891011121314151617181920212223
  1. -- Post-rollout finalizer for ingress-rejection log cleanup.
  2. --
  3. -- DO NOT run this during a rolling deployment. Run it only after:
  4. -- 1. every application instance is on the release that no longer reads or
  5. -- writes deleted_api_key_audits and the deprecated ops_error_logs columns;
  6. -- 2. cleanup-ingress-reject-logs has been dry-run and, if desired, executed;
  7. -- 3. a database backup or recovery point has been verified.
  8. BEGIN;
  9. SET LOCAL lock_timeout = '5s';
  10. SET LOCAL statement_timeout = '10min';
  11. DROP TABLE IF EXISTS deleted_api_key_audits;
  12. ALTER TABLE IF EXISTS ops_error_logs
  13. DROP COLUMN IF EXISTS attempted_key_prefix,
  14. DROP COLUMN IF EXISTS deleted_key_owner_user_id,
  15. DROP COLUMN IF EXISTS deleted_key_name;
  16. COMMIT;
  17. -- Run this separately during a normal maintenance window:
  18. -- VACUUM (ANALYZE) ops_error_logs;