Database

Before we get into the app code, I want to review how the database is set up. Keeping the database in mind will make things easier when we are discussing some of the application logic.

Database Diagram

There are four tables.

template, placeholder, replacement, and generated. Templates is the main table with a foreign key (1:n) to each of the other tables. Replacement has an additional foreign key (1:n) with the placeholder table.

The ddl to create the tables is in the query folder, in the database_maintenance.py file.


template


placeholder


replacement


generated