db-operator icon indicating copy to clipboard operation
db-operator copied to clipboard

Add optional initilization SQL queries

Open tobikris opened this issue 2 years ago • 1 comments

Thanks for this awesome operator! Some applications do not initialize their database on their own. It would be very convenient if the CRD included an optional parameter to specify custom SQL queries to be run on database creation. In my opinion the "contract" should be that those queries can be run several times (e.g. on updates to the custom resource). The queries need to include something like CREATE TABLE IF NOT EXISTS to handle this. I guess this should not be too hard to implement and is a nice addition for convenient usage. Thanks for the consideration.

tobikris avatar Sep 17 '22 21:09 tobikris

Hi thanks for your issue.

Think it's sounds interesting, but also I would try not to have a feature overloaded db-operator with everything possible implemented.

My idea for your issue would mostly use before you app container in the k8s pod an init container, managing and updating the database. A dedicated tool means also you could test the related configs/migration local and in a CI/CD pipeline. db-operator can run local in minikube or k3d, but I try to avoid this 😄

Checkout this project https://atlasgo.io/getting-started/ and see if this is solving your request.

dabde avatar Sep 22 '22 13:09 dabde

Hi, @tobikris Due to lack of resources, we are now only focusing on maintaining and bug fixing. Any feature request, suggestion can be address here: https://github.com/db-operator/db-operator

hyunysmile avatar Apr 18 '23 14:04 hyunysmile