Skip to content

System schema ​

FbExpert keeps its configuration in a dedicated Firebird database, the system database. It holds no business data: only users and permissions, the database registry, backups, imports, projects and audit.

System database and user databases
The system database is opened by the embedded engine; user databases are opened by their own kit.

Files ​

ItemPurpose
DataDirectory/FBEXPERT.FB5system database
DataDirectory/system/FBEXPERT.template.fb5template used to create a new system database
DataDirectory/runtime/firebird/5.0/clean Firebird 5 runtime (without UDR/UDF)
DataDirectory/keys/backup.keykey for the backup vault
DataDirectory/keys/data-protection/keys for cookies and anti-forgery tokens
DataDirectory/system-schema.versionschema version for which the pre-migration backup was taken

The embedded runtime is rebuilt automatically if the Firebird kit is replaced (the client fingerprint is recorded in the manifest).

Main content ​

TableContent
FBEXPERT_USERSaccounts, role, status, OTP, preferences (language, tab)
FBEXPERT_ACCESS_AUDITlog of logins, denials and changes
FBEXPERT_SCHEMA_MIGRATIONShistory of system schema migrations
FBEXPERT_BACKUPSbackup catalog (scope, path, status, SHA-256, encryption)
FBEXPERT_IMPORT_JOBSpersisted import jobs
FBEXPERT_TRANSFORM_TASKStransformation tasks (projects)
FBEXPERT_HOME_LAYOUTper-user home page layout
FBEXPERT_PROJECT_HOMElayout shared per project

The security, project and backup tables are created by their repository (EnsureSchemaAsync) if they are missing: this is the safety net for an old database.

Versioned migrations ​

Since schema 8.0, changes go through numbered steps, applied one transaction per step:

StepDescription
1system schema foundation
2FBEXPERT_IMPORT_JOBS.PROJECT_ID + index
3FBEXPERT_TRANSFORM_TASKS.PROJECT_ID nullable
4FBEXPERT_HOME_LAYOUT table
5FBEXPERT_PROJECT_HOME table

Rules:

  • a published step is never modified; a new one is added instead;
  • additive only: table, column, index, DROP NOT NULL; never DROP COLUMN;
  • each step is idempotent (it checks before acting);
  • if a step fails, it is rolled back and the application starts in a degraded state with the /startup-error page.

Inspect the state:

sql
SELECT VERSION, DESCRIPTION, APPLIED_AT
  FROM FBEXPERT_SCHEMA_MIGRATIONS
 ORDER BY VERSION;

Pre-migration backup ​

The embedded engine allows only a single process: gbak cannot read the database while the service is running. The backup therefore runs at startup, before the database is opened:

  • if system-schema.version differs from the current version → pre-migration backup;
  • otherwise, if there is no recent .fbk file (interval Firebird:BackupIntervalHours) → periodic backup.

On demand, with the service stopped:

bash
sudo systemctl stop fbexpert
sudo runuser -u fbexpert -- \
  env HOME=/var/lib/fbexpert XDG_DATA_HOME=/var/lib/fbexpert/.local/share \
  /opt/fbexpert/FbExpert.Blazor --backup-system
sudo systemctl start fbexpert

Files produced outside a session are imported into the catalog and encrypted at the next startup.

Diagnostics ​

MessageCause
FBEXPERT_… : schéma non vérifiabletable missing or migration interrupted
Install incomplete…the kit's security database is not initialized
Database already opened with engine instancea second process on the embedded database (service still running)
detailed /startup-errorruntime or kit missing, permissions denied

Tools: FbExpert.Blazor --check-password <user>, --backup-system, --version, and the /startup-error page.