Pave Hive uses one migration pipeline for SQLite, SQL Server and Postgres. It applies EF Core migrations first, creates missing ServiceStack ApiKey and CrudEvent tables, then checks their columns and the Project OrmLite model against the database. SQL Server and Postgres use schema pave and migration history pave.MigrationCore. SQLite has no schemas or database roles.
The command is safe to repeat against an up-to-date database:
Pave.Hive.exe migrate-database
For a framework-dependent installation, run dotnet Pave.Hive.dll migrate-database. The command returns 0 on success, 1 for a migration failure and 2 for invalid configuration or arguments. Run only one migration process per database at a time. A failure can leave earlier steps applied; correct the cause and rerun the command before starting the new web version.
Configuration
Set HIVE_APPSETTINGS to the Hive JSON settings file. The command requires this file when the variable is set. Without the override, it uses the normal Pave Hive settings-file location. The shared HiveServerHost composes appsettings, the Hive file, Development user secrets, environment variables and command-line configuration in that order; later sources win. Hive JSON settings are loaded once at startup. Migration, readiness and product services use the same effective database configuration.
| Setting | Purpose |
|---|---|
ConnectionStrings:PaveDatabase |
Web connection and the command's fallback connection. Set it through ConnectionStrings__PaveDatabase for an environment override. |
HiveDatabase:Provider |
Optional explicit Sqlite, SqlServer or Postgres; use HiveDatabase__Provider in the environment when connection-string inference is insufficient. |
HiveDatabase:MigrationConnectionString |
Command-only migration connection; set it through HiveDatabase__MigrationConnectionString. Web startup ignores it. |
HiveDatabase:Authentication |
Password by default, or EntraManagedIdentity for Postgres with a password-free connection. The shared Npgsql data source refreshes Entra tokens for EF, OrmLite, migration and readiness. |
HiveDatabase:Migration |
Startup by default, or Explicit to disable schema changes during web startup. The environment variable is HiveDatabase__Migration. |
Keep connection secrets in protected settings or environment variables, not command-line arguments. For SQLite, use a file database; a relative path resolves beside the loaded Hive settings file. SQL Server and Postgres require an existing database.
IIS
Existing IIS and development installations keep the default Startup mode. After building the host and before accepting requests, Pave applies the full migration pipeline using ConnectionStrings:PaveDatabase. With integrated authentication, the application pool identity therefore needs DDL rights as well as data access. Migration failure prevents startup.
To use an application pool identity with data rights only:
- Stop the application pool before changing its database schema.
- Set
HIVE_APPSETTINGSfor the migration process to the Hive settings file. Supply a migration identity throughHiveDatabase__MigrationConnectionString, or run with a Windows identity that has migration rights when the connection uses integrated authentication. - Run
Pave.Hive.exe migrate-databasefrom the installed Hive directory and require exit code0. - Set
HiveDatabase:MigrationtoExplicitin the Hive settings file, or setHiveDatabase__Migration=Explicitfor the web process. KeepConnectionStrings:PaveDatabaseon the runtime identity. - Start the application pool. Pave's administrator checks still require the applied baseline and can refuse startup when required database state is missing.
Initialize-PaveDatabase continues to apply EF migrations only. It does not create the ServiceStack ApiKey and CrudEvent tables or run the shared agreement check. Use migrate-database for complete database preparation before starting a Hive in Explicit mode.
Containers
Run a migration Job from the same Hive image before starting the new web revision. Set HiveDatabase__MigrationConnectionString on that Job to the migration identity's connection, then run migrate-database. Require exit code 0 before continuing delivery. The migration identity needs rights to apply EF schema changes and create missing ServiceStack tables.
Run the web container with HiveDatabase__Migration=Explicit and ConnectionStrings__PaveDatabase set to a data-only runtime connection. Do not give the web workload the migration connection. On SQL Server, the runtime user needs data-reader and data-writer rights without DDL rights. On Postgres, grant USAGE on schema pave, the required table data privileges and sequence access without CREATE. SQLite deployments share the database volume between the migration and web containers; SQLite cannot enforce a separate database role.
The Hive's .deploy/docker-compose.yml uses migrate-database for its migration service and Explicit for the web service. Configure the settings file, connection environment and database volume for the target installation before using it.
Explicit performs no schema changes. Its pending-migration diagnostic is read-only and may warn about an unavailable or outdated database; it does not replace migration or the product's startup checks. ServiceStack creates missing tables during migration only and never alters existing ones. If a later ServiceStack version needs another column, migration fails the agreement check until a targeted schema change supplies it.
Hosted readiness
The shared host owns startup migration, forwarded-header trust, path-base handling, default listening address, health and the check-health command. Without an explicit Kestrel endpoint, URL or HTTP/HTTPS port setting, Pave listens on HTTP port 3183. Containers use port 8080; Compose sets it explicitly. The image carries HIVE_APPSETTINGS=/app/Container/hive.json. Kubernetes and ACA declarations supply the database and instance settings at runtime.
/health reports process liveness. /health/ready requires complete migration history and a matching EF model through the shared database check, plus Pave's MapCache check when a companion is configured. Health runs inside AppBasePath, before product authentication and HTTPS redirection. check-health probes the mounted ready endpoint using the configured listener. Do not set ASPNETCORE_FORWARDEDHEADERS_ENABLED; configure trusted proxies or networks through HiveHosting instead.
Pave keeps Auth, ServiceStack, Blazor, CORS and FastCGI/MapCache proxy behaviour in its product descriptor. After shared migration, its hosted lifecycle service verifies or seeds an Auth administrator and atomically publishes MapCache configuration before the server accepts requests. ServiceStack build-time AppTasks skip migration, seeding and MapCache publication. The file key-ring fallback remains beside the selected Hive settings file when the shared database key ring is not selected.