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.
Before you start
Section titled “Before you start”- Back up the current engine and filesystem together and prove an isolated restore. Use a separate empty PostgreSQL target for a migration trial.
-
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.
-
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.
-
Review the importer without mutation first:
Terminal window bun run import:postgresIt 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.
-
In a stopped, isolated migration trial, run
bun run import:postgres --applyonly 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. -
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.
Check the result
Section titled “Check the result”- The selected engine contains the intended data and the application preserves tenant isolation, assets and restart behavior.
Troubleshooting
Section titled “Troubleshooting”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.
Related guides
Section titled “Related guides”Applies to Strukt c02552848c92 · 2026-10-31