Support separate configuration of user, password and host name #732
Closed
stefaneg
started this conversation in
Feature Ideas
Replies: 1 comment 5 replies
-
|
@stefaneg # cat <<-'EOT' >.env
DATABASE_USER=root
DATABASE_PASSWORD=root
DATABASE_HOST=mysql
DATABASE_NAME=dbmate_test
DATABASE_URL=mysql://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}/${DATABASE_NAME}
EOT
# cat .env
DATABASE_USER=root
DATABASE_PASSWORD=root
DATABASE_HOST=mysql
DATABASE_NAME=dbmate_test
DATABASE_URL=mysql://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}/${DATABASE_NAME}
# dist/dbmate -d testdata/db/migrations up
Creating: dbmate_test
Applying: 20151129054053_test_migration.sql
Applied: 20151129054053_test_migration.sql in 19.427218ms
Applying: 20200227231541_test_posts.sql
Applied: 20200227231541_test_posts.sql in 19.542ms
Writing: ./db/schema.sql
|
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In certain setups, like when using temporary generated database credentials to run migrations, it is a bit of a hassle to put together a connection string for dbmate. It would make dbmate much more convenient in this scenario if it supported reading the password from environment or .env file and insert into the connection string. To illustrate the idea:
DATABASE_USER=dbuser
DATABASE_PASSWORD=asadfqwerty
DATABASE_URL=db://{{DATABASE_USER}}:{{DATABASE_PASSWORD}}@{{DATABASE_HOSTNAME}}
Beta Was this translation helpful? Give feedback.
All reactions