Problem
Currently the database documentation is spread out over multiple places:
- In /doc/database
- As comments in the backend code, e.g. entity.rs
Some database constraints are not documented at all, as far as I can see. [1] [2]
Ideally, there should be only one place to look for database documentation.
#792 updates and improves the database documentation itself but does not narrow down the spread of information
Possible solution
In the last meeting we talked shortly about database comments and diesel:
In diesel 2.1+ it's possible to include database comments like the following in the schema.rs:
COMMENT ON COLUMN maps.name IS 'The name of the map
Example: "My map"
(only alphanumerical characters and whitespace)';
COMMENT ON TABLE maps IS 'Some description about the maps table';
The generated schema.rs will then contain the following:
diesel::table! {
use postgis_diesel::sql_types::Geography;
use diesel::sql_types::*;
use super::sql_types::PrivacyOption;
use super::sql_types::Geography;
use super::sql_types::Geometry;
/// Some description about the maps table
maps (id) {
id -> Int4,
/// The name of the map
/// Example: "My map"
/// (only alphanumerical characters and whitespace)
name -> Text,
creation_date -> Date,
deletion_date -> Nullable<Date>,
last_visit -> Nullable<Date>,
[...]
From the database comments we could then rather easily generate a markdown table for /doc/database/schemata/03er_table_descriptions.md
Thoughts
Maybe schema.rs is not the best place to aggregate all database documentation?
This process seems kind of awkward to me, but manually adding database documentation in multiple places doesn't seem ideal either.
Do you have any thoughts on this?
@markus2330 @Bushuo @horenso
Problem
Currently the database documentation is spread out over multiple places:
Some database constraints are not documented at all, as far as I can see. [1] [2]
Ideally, there should be only one place to look for database documentation.
#792 updates and improves the database documentation itself but does not narrow down the spread of information
Possible solution
In the last meeting we talked shortly about database comments and diesel:
In diesel 2.1+ it's possible to include database comments like the following in the
schema.rs:The generated
schema.rswill then contain the following:From the database comments we could then rather easily generate a markdown table for /doc/database/schemata/03er_table_descriptions.md
Thoughts
Maybe schema.rs is not the best place to aggregate all database documentation?
This process seems kind of awkward to me, but manually adding database documentation in multiple places doesn't seem ideal either.
Do you have any thoughts on this?
@markus2330 @Bushuo @horenso