'Docker & Postgres - Rename database & remove old one

I have my Gitlab CI running with Symfony, I have fixtures loaded and I want to load them in a buffer dabatase, and then to move them to the real database.

I've seen this thread: Docker - How can run the psql command in the postgres container?, but I would like to have an automatic script which:

  • delete my real database
  • rename my buffer database to the real database's name

Is it possible using Docker & Gitlab CI to automate such commands? I am using pg_dump for now, but it's long an not easy to use, I just want to replace a DB with an other DB.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source