{% extends "base.html" %} {% block title %}{{ _('Database Management') }}{% endblock %} {% block content %}

{{ _('Database Management') }}

{{ _('Dashboard') }}
{{ _('Current Database') }}
{{ _('Type') }}:

{% if db_info.type == 'SQLite' %} SQLite {% else %} PostgreSQL {% endif %}

URL:

{{ db_info.url }}

{% if db_info.is_default %} {{ _('Default Database') }} {% else %} {{ _('Connected Database') }} {% endif %}
{{ stats.sites }}

{{ _('Sites') }}

{{ stats.us }}

{{ _('Stratigraphic Units') }}

{{ stats.inventory }}

{{ _('Inventory') }}

{{ _('Database Operations') }}
{{ _('Upload an existing SQLite .db file') }}
{{ _('Connect to PostgreSQL or local SQLite') }}
{{ _('View tables and detailed statistics') }}
Create Empty Database

Create a new empty database with full PyArchInit-Mini schema.

Database file will be created as: ~/.pyarchinit_mini/data/[name].db
Warning: This will delete existing database and all its data!
Database Schema

The new database will include all PyArchInit-Mini tables:

  • Sites (site_table)
  • Stratigraphic Units (us_table)
  • US Relationships
  • Periodization & Dating
  • Harris Matrix
  • Inventory (inventario_materiali_table)
  • Thesaurus
  • Media & Documentation
  • Users
{{ _('Data Migration (SQLite ↔ PostgreSQL)') }}

{{ _('Migrate all data from source database to target database. Supports bidirectional migration between SQLite and PostgreSQL.') }}

{{ _('Source Database') }}
{{ _('Target Database') }}
{{ _('Warning: Deletes existing database!') }}
{{ _('Recommended: Creates timestamped backup of source database') }}
{{ _('Conflict Resolution Strategy') }}
{{ _('Choose how to handle records with duplicate IDs between source and target databases.') }}

{{ _('Skip records with conflicting IDs. Target data is preserved, only new records are added.') }}

{{ _('Update existing records with source data. Use when source has the latest information.') }}

{{ _('Generate new IDs for conflicting records. Keeps all data from both databases.') }}

{% if connections %}
{{ _('Saved Connections') }}
{% for name, conn in connections.items() %} {% endfor %}
{{ _('Name') }} {{ _('Type') }} {{ _('Description') }} {{ _('Source') }} {{ _('Actions') }}
{{ name }} {% if conn.url == db_info.url %} {{ _('Active') }} {% endif %} {% if conn.type == 'sqlite' %} SQLite {% else %} PostgreSQL {% endif %} {{ conn.description or '-' }} {% if conn.uploaded %} {{ _('Uploaded') }} {% else %} Default {% endif %}
{% if conn.url == db_info.url %} {% else %}
{% endif %}
{% endif %}
{{ _('Help') }}
{{ _('Upload SQLite Database') }}

{{ _('Upload an existing .db file from PyArchInit desktop or other sources. The file is validated and saved in the databases folder.') }}

{{ _('Connect Database') }}

{{ _('Connect to a remote PostgreSQL database or a local SQLite file. The connection is tested before being saved.') }}

{{ _('Security') }}

{{ _('Connection credentials are stored only in session. For permanent connections, use environment variables.') }}

{% endblock %}