{% extends 'dashboard.html' %} {% block page %}

Database Schema

Visual representation of your database structure with tables and relationships.

Entity Relationship Diagram

erDiagram
{% for table in schema_info %}
    {{ table.table_name|upper }} {
{% for col in table.columns %}        {{ col.data_type|replace(' ', '_') }} {{ col.column_name }}{% if col.column_name in table.primary_keys %} PK{% endif %}
{% endfor %}    }
{% endfor %}
{% for table in schema_info %}
{% for fk in table.foreign_keys %}
    {{ table.table_name|upper }} }|--|| {{ fk.foreign_table_name|upper }} : "references"
{% endfor %}
{% endfor %}
            

Tables Overview

{% for table in schema_info %}

{{ table.table_name }}

{{ table.columns|length }} column{{ 's' if table.columns|length != 1 else '' }} {% if table.primary_keys %} ยท {{ table.primary_keys|length }} PK {% endif %}

{% for col in table.columns %}
{% if col.column_name in table.primary_keys %} {% else %} {% endif %}
{{ col.column_name }} {{ col.data_type }} {% if col.is_nullable == 'NO' %} * {% endif %}
{% endfor %}
{% if table.foreign_keys %}

References:

{% for fk in table.foreign_keys %}
{{ fk.foreign_table_name }} ({{ fk.column_name }})
{% endfor %}
{% endif %}
{% endfor %}
{% endblock %}