Skip to content

Working with SQLDocs

Frank Stüber edited this page Jul 31, 2023 · 2 revisions

Create a new database schama file

To create a new database schema JSON file for a PostgreSQL database, type something like this:

sqldocs build-json 
  -l en 
  -db postgres 
  -c "Server=localhost;Port=5432;Database=mydatabase;User ID=postgres;Password=qwertz;" 
  -s "c:\my-mkdocs-project\dbschema.json"

To create a new database schema JSON file for a Firebird database, type something like this:

sqldocs build-json 
  -l en 
  -db firebird 
  -c "Host=localhost;Database='c:\database\mydatabase.fdb';Charset=UTF8;User ID=sysdba;Password=qwertz;" 
  -s "c:\my-mkdocs-project\dbschema.json"

With subsequent calls, the JSON file is not completely recreated, but rather updated with new data. This means that manual changes (e.g. descriptions) are not overwritten.

Create a new MkDocs project

To create a new MkDocs project for a PostgreSQL database, type something like this:

sqldocs build-mkdocs 
  -l en 
  -db postgres 
  -s "c:\my-mkdocs-project\dbschema.json" 
  -o "c:\my-mkdocs-project"

To create a new MkDocs project for a Firebird database, type something like this:

sqldocs build-mkdocs 
  -l en 
  -db firebird 
  -s "c:\my-mkdocs-project\dbschema.json" 
  -o "c:\my-mkdocs-project"

With subsequent calls, the MkDocs project is not completely recreated, but rather updated with new data. This means that manual changes are not overwritten.

Everything in one step

You can combine both commands into one.

For a PostgreSQL database, type something like this:

sqldocs build-json-mkdocs 
  -l en 
  -db postgres 
  -c "Server=localhost;Port=5432;Database=mydatabase;User ID=postgres;Password=qwertz;" 
  -s "c:\my-mkdocs-project\dbschema.json" 
  -o "c:\my-mkdocs-project"

For a Firebird database, type something like this:

sqldocs build-json-mkdocs 
  -l en 
  -db firebird 
  -c "Host=localhost;Database='c:\database\mydatabase.fdb';Charset=UTF8;User ID=sysdba;Password=qwertz;" 
  -s "c:\my-mkdocs-project\dbschema.json" 
  -o "c:\my-mkdocs-project"

Description formatting

Descriptions in the database schema JSON file support the following formatting:

  • Links to other database objects

    Example:

    This a link to table @table:public.film_actor and this is a link to view @view:public.staff_list.
    
  • Bold HTML tag

    Example:

    This is a <b>bold text string</b>.
    
  • Italic HTML tag

    Example:

    This is an <i>italic text string</i>.
    
  • Code HTML tag

    Example:

    This is some SQL code: <code>SELECT * FROM table</code>.