Skip to content

Local search · English

    SQLite and PostgreSQL operations

    Without DATABASE_URL, Strukt uses its persistent SQLite platform/site databases. With a valid PostgreSQL URL, account and site rows use PostgreSQL while media, digital assets and exports still require the filesystem. Changing the variable alone does not migrate existing data.

    • Back up the current engine and filesystem together and prove an isolated restore. Use a separate empty PostgreSQL target for a migration trial.
    1. Keep SQLite for a simple single-installation deployment when its operational model suits the workload. Stop writers for a consistent stopped-copy backup, preserve the complete data tree and run integrity checks on a restored copy.

    2. For PostgreSQL, configure a postgres/postgresql URL with host and database name using a private credential. Set DATABASE_POOL_MAX against the server’s max_connections budget across all processes. Default 16 includes a reserved platform slot; active website work pins scoped leases while idle leases can be reclaimed.

    3. Review the importer without mutation first:

      Terminal window
      bun run import:postgres

      It reads STRUKT_DATA_DIR and DATABASE_URL and prints a dry-run plan. The target must be empty. Resolve reported validation/conflicts before applying a copy. Never print the database URL in public evidence.

    4. In a stopped, isolated migration trial, run bun run import:postgres --apply only after reviewing the plan. Preserve the SQLite source and verify imported counts, constraints, login/site reads, immutable assets and representative exports. Test with the candidate application before any production cutover.

    5. Use PostgreSQL-native consistent backup/recovery coordinated with filesystem assets. Keep a documented rollback path and the original encryption key. Monitor bounded connection refusal/503 and transaction errors rather than raising the pool without a total server budget.

    • The selected engine contains the intended data and the application preserves tenant isolation, assets and restart behavior.

    A connection-budget 503 is different from a missing table or authentication failure. Preserve failure evidence privately and follow the engine-specific recovery plan. Do not run the importer against a populated target or assume its dry run performed a migration.

    Applies to Strukt c02552848c92 · 2026-10-31