Simplifying setup: don't use any parameters

We can do this by using the driver and server_version config. Then, we
can just set DATABASE_URL to blank, to supress the error that it does
not exist. If it *is* set, it overrides the driver option, but they
should match anyways.
This commit is contained in:
Ryan Weaver
2017-11-19 20:33:10 +02:00
parent 25e96782f5
commit cb9f0ede5f
3 changed files with 14 additions and 15 deletions
@@ -1,15 +1,18 @@
parameters:
# adds a fallback URL if the env var is not set
# this is useful to allow you to run cache:warmup
# even when your environment variables don't yet exist
# you should not need to change this value
env(DATABASE_URL): '%doctrine.database_server%://'
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): ''
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.7'
# With Symfony 3.3, remove the `resolve:` prefix
url: '%env(resolve:DATABASE_URL)%'
server_version: '%doctrine.server_version%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
@@ -11,9 +11,5 @@
"#2": "For an SQLite database, use: \"sqlite:///%kernel.project_dir%/var/data.db\"",
"#3": "Set \"serverVersion\" to your server version to avoid edge-case exceptions and extra database calls",
"DATABASE_URL": "mysql://db_user:db_password@127.0.0.1:3306/db_name?charset=utf8mb4"
},
"container": {
"doctrine.database_server": "mysql",
"doctrine.server_version": "5.7"
}
}
@@ -1,8 +1,8 @@
<bg=blue;fg=white> </>
<bg=blue;fg=white> Configure your database </>
<bg=blue;fg=white> </>
<bg=blue;fg=white> </>
<bg=blue;fg=white> Next: Configuration </>
<bg=blue;fg=white> </>
* Modify your DATABASE_URL config in <fg=green>.env</>
* Configure the <fg=green>database_server</> (mysql) and
<fg=green>server_version</fg> (5.7) in <fg=green>config/services.yaml</>
* Configure the <fg=green>driver</> (mysql) and
<fg=green>server_version</fg> (5.7) in <fg=green>config/packages/doctrine.yaml</>