Files
metabuilder/dbal/templates/sql/sqlite_create_table.sql.j2
2026-03-09 22:30:41 +00:00

4 lines
409 B
Django/Jinja

CREATE TABLE IF NOT EXISTS "{{ table_name }}" (
{% for field in fields %} "{{ field.name }}" {{ field.type }}{% if field.primary %} PRIMARY KEY{% endif %}{% if field.required and not field.primary %} NOT NULL{% endif %}{% if field.unique and not field.primary %} UNIQUE{% endif %}{% if existsIn(field, "default") %} DEFAULT {{ field.default }}{% endif %}{% if not loop.is_last %},
{% endif %}{% endfor %}
)