diff options
Diffstat (limited to 'doc/development/database/database_dictionary.md')
-rw-r--r-- | doc/development/database/database_dictionary.md | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/doc/development/database/database_dictionary.md b/doc/development/database/database_dictionary.md index bd6dbc54316..d74d7e77edb 100644 --- a/doc/development/database/database_dictionary.md +++ b/doc/development/database/database_dictionary.md @@ -11,7 +11,8 @@ locate the feature categories responsible for specific database tables. ## Location -Database dictionary metadata files are stored in the `gitlab` project under `db/docs/`. +Database dictionary metadata files are stored in the `gitlab` project under `db/docs/` for the `main` and `ci` databases. +For the `geo` database, the dictionary files are stored under `ee/db/docs/`. ## Example dictionary file @@ -29,23 +30,43 @@ milestone: '13.0' ## Schema -| Attribute | Type | Required | Description | -|----------------------|---------------|----------|--------------------------------------------------------------------------| -| `table_name` | String | yes | Database table name | -| `classes` | Array(String) | no | List of classes that respond to `.table_name` with the `table_name` | -| `feature_categories` | Array(String) | yes | List of feature categories using this table | -| `description` | String | no | Text description of the information stored in the table and it's purpose | -| `introduced_by_url` | URL | no | URL to the merge request or commit which introduced this table | -| `milestone` | String | no | The milestone that introduced this table | +| Attribute | Type | Required | Description | +|----------------------------|---------------|----------|-----------------------------------------------------------------------------------| +| `table_name` / `view_name` | String | yes | Database table name or view name | +| `classes` | Array(String) | no | List of classes that are associated to this table or view. | +| `feature_categories` | Array(String) | yes | List of feature categories using this table or view. | +| `description` | String | no | Text description of the information stored in the table or view, and its purpose. | +| `introduced_by_url` | URL | no | URL to the merge request or commit which introduced this table or view. | +| `milestone` | String | no | The milestone that introduced this table or view. | +| `gitlab_schema` | String | yes | GitLab schema name. | ## Adding tables -When adding a new table, create a new file under `db/docs/` named -`<table_name>.yml` containing as much information as you know about the table. +When adding a new table, create a new file under `db/docs/` for the `main` and `ci` databases. +For the `geo` database use `ee/db/docs/`. +Name the file as `<table_name>.yml`, containing as much information as you know about the table. Include this file in the commit with the migration that creates the table. ## Dropping tables -When dropping a table, you must remove the metadata file from `db/docs/` -in the same commit with the migration that drops the table. +When dropping a table, you must remove the metadata file from `db/docs/` for `main` and `ci` databases. +For the `geo` database, you must remove the file from `ee/db/docs/`. +Use the same commit with the migration that drops the table. + +## Adding views + +When adding a new view, you should: + +1. Create a new file for this view in the appropriate directory: + - `main` database: `db/docs/views/` + - `ci` database: `db/docs/views/` + - `geo` database: `ee/db/docs/views/` +1. Name the file `<view_name>.yml`, and include as much information as you know about the view. +1. Include this file in the commit with the migration that creates the view. + +## Dropping views + +When dropping a view, you must remove the metadata file from `db/docs/views/`. +For the `geo` database, you must remove the file from `ee/db/docs/views/`. +Use the same commit with the migration that drops the view. |