Skip to content

Clean old PG databases based on their timestamped name

Notifications You must be signed in to change notification settings

af83/pgdb_cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

# Introduction

When many test databases are created in a mutualized PG server during CI tests (we use Jenkins here), and when they are not cleand-up after the tests are finished, this tool is regularly scheduled by our CI to cleanup garbage databases. In order to do that, created databases must follow a naming convention : build_$(date +%Y%m%d%H%M)_anything_you_want

Usage :

docker run --rm -e PGHOST=mypgserver.local -e PGUSER=myuser -e PGPASSWORD=imapassword pgdb_cleaner

Environment variables

PGHOST, PGUSER, PGPORT, PGPASSWORD : connection informations for PostgreSQL tools (psql and pgdrop) DRYRUN : Do not perform ̀pgdrop, but simply list DBs eligible for deletion AGE : number of seconds before Ruby's Time.now before which db name timestamps are eligible for deletion. Defaults to 7200

About

Clean old PG databases based on their timestamped name

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published