{% import "macros.html" as ui %}
{# The page of an origin of the schema (`origin`, from databases.origins): a migration set (Flyway,
golang-migrate, dbmate, Alembic, Django, Prisma), an SQL file, or an ORM's models (SQLAlchemy, Django,
a Prisma schema). Its source, and the schema it ends with, each object to its page. Which databases it
describes and where they differ is DATABASES › Diff. #}
{% set KINDS = {"flyway": "Flyway migrations", "golang-migrate": "golang-migrate migrations", "dbmate": "dbmate migrations",
"dump": "schema dump", "sql file": "SQL file", "sqlalchemy": "SQLAlchemy models", "alembic": "Alembic migrations",
"django models": "Django models", "django migrations": "Django migrations", "prisma schema": "Prisma schema",
"prisma migrations": "Prisma migrations"} %}
{% set DIALECTS = {"postgres": "PostgreSQL", "mysql": "MySQL / MariaDB", "tsql": "SQL Server (T-SQL)", "sqlite": "SQLite"} %}
{% macro place(where) -%} {% for part in origin.folder.split("/") %}{{ part }}›{% endfor %} {% if origin.links %}Describes {% for link in origin.links %} {{ d.tool.value }}{{ said("version", " ") }}{{ said("server", " · from the server ") }}{% if d.host %} · host Part of Expects tables it does not create: {% for e in origin.expects %}{{ where.file.rsplit("/", 1)[-1] }}:{{ where.line }}{%- endmacro %}
{{ ui.icon("database") }}{{ origin.name.rsplit("@", 1)[-1] if origin.part_of else origin.name.rsplit("/", 1)[-1] }}{{ "database of a schema dump" if origin.part_of else KINDS[origin.kind] }}
{{ db_place(link.database) }}{% if not loop.last %}, {% endif %}{% endfor %}{% else %}Linked to no database read{% endif %}
{% if origin.related %} · Same schema as {{ origin.related }}{% endif %}
· {{ ui.icon("database") }}Diff
{{ ui.icon("database") }}Diagram
{{ ui.icon("database") }}Evolution{{ d.host.value }}{% endif %}{% if d.database %} · database {{ d.database.value }}{% endif %}{{ said("encoding", " · ") }}
· {% if g.source == "dump" %}made on {{ g.at | replace("T", " ") }} (written in the dump, line {{ g.line }}{% if not g.zone %}, no time zone{% endif %}){% elif g.source == "git" %}in the repository since {{ g.at | local_time }} (commit {{ g.commit[:10] }}, not when it was made){% else %}date unknown{% endif %}{{ origin.part_of }}, lines {{ origin.lines[0] }}–{{ origin.lines[1] }}: one of the databases the dump holds.{% for u in origin.unresolved %}
{{ e.table }} ({{ place(e) }}){% if not loop.last %}, {% endif %}{% endfor %}
{{ db_place(obj.path) }}
{% if where.created %}created {{ place(where.created) }}{% if where.changed != where.created %} · last changed {{ place(where.changed) }}{% endif %}{% endif %}{% if obj.data.comment %} · {{ obj.data.comment }}{% endif %}| Column | Type | Null | Default | Marks |
|---|---|---|---|---|
{{ c.name }} | {% if c.data.type %}{{ c.data.type }}{% else %}-{% endif %} |
{{ "yes" if c.data.nullable else "no" }} | {% if c.data.default %}{{ c.data.default }}{% elif c.data.computed %}{{ c.data.computed }} computed{% else %}-{% endif %} |
{% for mark in c.data.marks or [] if mark != "null" %}{{ db_marks[mark] }}{% else %}-{% endfor %} |
It declares no object.
{% endfor %} {% endcall %} {# The code itself, as CODE's Source block: each file of the origin in order (a migration's undo folded under it), fetched when shown, in the origin's dialect; what was not read is told by its line. #} {% call ui.section("source", "Source", count=origin.steps | length if origin.steps | length > 1 else none, name="source", divider=true) %} {# Each file folded at first under its title, opened by it (its code fetched then). #} {% for step in origin.steps %}{{ step.version }} · {% endif %}{{ step.title }} {{ step.file.rsplit("/", 1)[-1] }}Not read: the statement{% if unread | length > 1 %}s{% endif %} at line {{ unread | join(", ") }}.
{% endif %}Loading…
{{ step.down.rsplit("/", 1)[-1] }}Loading…