{% extends 'base.html' %} {% block title %}HyperXQL - Database Schema{% endblock %} {% block content %}

Database Schema

Explore your database structure and relationships

View ER Diagram Create New Table
Database Overview
{{ db_info.db_type|upper }}
{{ db_info.tables|length }}
Tables
{% set column_count = namespace(total=0) %} {% for table in db_info.tables %} {% set column_count.total = column_count.total + table.columns|length %} {% endfor %}
{{ column_count.total }}
Columns
{% set pk_count = namespace(total=0) %} {% for table in db_info.tables %} {% for column in table.columns %} {% if column.primary_key %} {% set pk_count.total = pk_count.total + 1 %} {% endif %} {% endfor %} {% endfor %}
{{ pk_count.total }}
Primary Keys
{% set fk_count = namespace(total=0) %} {% for table in db_info.tables %} {% set fk_count.total = fk_count.total + table.foreign_keys|length %} {% endfor %}
{{ fk_count.total }}
Relationships
{% if db_info.tables %}
Database Tables
{% for table in db_info.tables %} {% endfor %}
Table Name Columns Primary Key Foreign Keys Actions
Columns
{% for column in table.columns %} {% endfor %}
Name Type Nullable Default Constraints
{{ column.name }} {{ column.type }} {% if column.nullable %} {% else %} {% endif %} {% if column.default != None %} {{ column.default }} {% else %} NULL {% endif %} {% if column.primary_key %} PRIMARY {% endif %} {% if column.foreign_key %} FOREIGN {% endif %} {% if not column.nullable and not column.primary_key %} NOT NULL {% endif %}
{% if table.foreign_keys %}
Relationships
    {% for fk in table.foreign_keys %}
  • {{ table.name }}.{{ fk.column }} {{ fk.referred_table }}.{{ fk.referred_column }}
    REFERENCES
  • {% endfor %}
{% endif %} {% if table.indexes %}
Indexes
    {% for idx in table.indexes %}
  • {{ idx.name }} on {{ idx.columns|join(", ") }}
    {% if idx.unique %} UNIQUE {% else %} INDEX {% endif %}
  • {% endfor %}
{% endif %}
{% else %}

No Tables Found

Your database doesn't have any tables yet.

Create Your First Table
{% endif %}
Quick Actions
New Query {% if db_info.tables %} Show All Tables Add Table {% endif %}
{% endblock %} {% block styles %} {% endblock %}