trilogy-libraries / activerecord-trilogy-adapter

Active Record adapter for the Trilogy database client for Rails v6.0 - v7.0.
https://github.com/trilogy-libraries/trilogy
MIT License
172 stars 17 forks source link

DATABASE_URL compatibility with mysql2://... #67

Open joevandyk opened 1 year ago

joevandyk commented 1 year ago

We're looking to migrate from mysql2 to trilogy.

We are using a DATABASE_URL like mysql2://.....

Say we're migrating to trilogy. That DATABASE_URL (right now) can't be used if there's no mysql2 gem loaded. So we would need to somehow magically switch to a different DATABASE_URL env var when the new apps boot.

On systems like heroku, I believe this would require a bit of downtime - shutdown running version, update DATABASE_URL from mysql2:// to trilogy://, then deploy the new app.

Is there a way around this where we can use trilogy using a DATABASE_URL containing mysql2:// ?

D-system commented 10 months ago

You can install both adapters (mysql2 and trilogy), update the environment variable (in Heroku it will trigger a new deployment or similar) then you can remove the mysql2 gem.