Read DATABASE_ADAPTER variable from app when setting DATABASE_URL

This commit is contained in:
Peter West
2016-01-18 15:58:16 +00:00
parent cdd357b058
commit b7b25c91a0
4 changed files with 53 additions and 0 deletions

View File

@@ -129,3 +129,30 @@ dokku mysql:clone lolipop new_database
# finally, you can destroy the container
dokku mysql:destroy lolipop
```
## Changing database adapter
It's possible to change the protocol for DATABASE_URL by setting
the environment variable DATABASE_ADAPTER on the app:
```
dokku config:set lolipop DATABASE_ADAPTER=mysql2
dokku mysql:link lolipop playground
```
Will cause DATABASE_URL to be set as
mysql2://mysql:SOME_PASSWORD@dokku-mysql-lolipop:3306/lolipop
CAUTION: Changing DATABASE_ADAPTER after linking will cause dokku to believe
the service is not linked when attempting to use `dokku mysql:unlink` or
`dokku mysql:promote`.
You should be able to fix this by
- Changing DATABASE_URL manually to the new value.
OR
- Set DATABASE_ADAPTER back to its original setting
- Unlink the service
- Change DATABASE_ADAPTER to the desired setting
- Relink the service