Commit b68a7d87 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'db-decompose-config' into 'master'

Add documentation about config/database.yml

See merge request gitlab-org/gitlab!70292
parents 8c225d6a 784ad8ae
......@@ -24,6 +24,7 @@ configurations. For example, given a `config/database.yml` like below:
```yaml
development:
main:
adapter: postgresql
encoding: unicode
database: gitlabhq_development
......@@ -34,6 +35,7 @@ development:
statement_timeout: 120s
test: &test
main:
adapter: postgresql
encoding: unicode
database: gitlabhq_test
......@@ -412,3 +414,50 @@ The `url` parameter should point to an issue with a milestone for when we intend
to fix the cross-join. If the cross-join is being used in a migration, we do not
need to fix the code. See <https://gitlab.com/gitlab-org/gitlab/-/issues/340017>
for more details.
## `config/database.yml`
GitLab will support running multiple databases in the future, for example to [separate tables for the continuous integration features](https://gitlab.com/groups/gitlab-org/-/epics/6167) from the main database. In order to prepare for this change, we [validate the structure of the configuration](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67877) in `database.yml` to ensure that only known databases are used.
Previously, the `config/database.yml` would look like this:
```yaml
production:
adapter: postgresql
encoding: unicode
database: gitlabhq_production
...
```
With the support for many databases the support for this
syntax is deprecated and will be removed in [15.0](https://gitlab.com/gitlab-org/gitlab/-/issues/338182).
The new `config/database.yml` needs to include a database name
to define a database configuration. Only `main:` and `ci:` database
names are supported today. The `main:` needs to always be a first
entry in a hash. This change applies to decomposed and non-decomposed
change. If an invalidate or deprecated syntax is used the error
or warning will be printed during application start.
```yaml
# Non-decomposed database
production:
main:
adapter: postgresql
encoding: unicode
database: gitlabhq_production
...
# Decomposed database
production:
main:
adapter: postgresql
encoding: unicode
database: gitlabhq_production
...
ci:
adapter: postgresql
encoding: unicode
database: gitlabhq_production_ci
...
```
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment