Class PostgreSQLInstaller
- Namespace
- FishMMO.Installer
- Assembly
- FishMMO-Installer.dll
PostgreSQL security hardening: rewrites pg_hba.conf to require
scram-sha-256 on all TCP entries, sets password_encryption and
listen_addresses in postgresql.conf, then reloads the server via
pg_reload_conf(). Idempotent: re-runs detect the managed marker and skip.
Linux-only; on Windows the installer prints a hint and exits.
public static class PostgreSQLInstaller
- Inheritance
-
PostgreSQLInstaller
- Inherited Members
Methods
CreateMigration(AppSettings)
Creates a new database migration and applies it using dotnet ef commands.
Prompts for the PostgreSQL superuser password so the migration can be
applied via dotnet ef database update --connection, which bypasses
the design-time factory and its potentially stale appsettings.json.
public static Task CreateMigration(AppSettings appSettings)
Parameters
appSettingsAppSettings
Returns
DeleteFishMMODatabase(string, string, AppSettings)
Deletes the FishMMO database as defined in appsettings.json. Requires PostgreSQL superuser credentials. This operation is DANGEROUS and irreversible.
public static Task DeleteFishMMODatabase(string superUsername, string superPassword, AppSettings appSettings)
Parameters
superUsernamestringPostgreSQL superuser name.
superPasswordstringPostgreSQL superuser password.
appSettingsAppSettingsApplication settings for database configuration.
Returns
GrantUserPermissions(string, string, AppSettings, string?)
Grants comprehensive permissions to a specified user on a specific database. Includes permissions on existing and future tables, sequences, and functions.
public static Task GrantUserPermissions(string superUsername, string superPassword, AppSettings appSettings, string? appUsername = null)
Parameters
superUsernamestringPostgreSQL superuser name.
superPasswordstringPostgreSQL superuser password.
appSettingsAppSettingsApplication settings for database configuration.
appUsernamestring
Returns
HardenPostgreSQLAsync(NpgsqlConnection, AppSettings)
Apply PostgreSQL security hardening using an already-connected superuser session. Safe to call repeatedly; existing edits are detected by the managed marker.
public static Task HardenPostgreSQLAsync(NpgsqlConnection connection, AppSettings appSettings)
Parameters
connectionNpgsqlConnectionappSettingsAppSettings
Returns
InstallFishMMODatabase(string, string, AppSettings)
Installs the FishMMO database, creates the application user role, grants privileges, and optionally runs the initial migration.
public static Task InstallFishMMODatabase(string superUsername, string superPassword, AppSettings appSettings)
Parameters
superUsernamestringPostgreSQL superuser name.
superPasswordstringPostgreSQL superuser password.
appSettingsAppSettingsApplication settings for database configuration.
Returns
InstallPostgreSQL(AppSettings)
Installs PostgreSQL on the current platform by dispatching to the appropriate platform-specific method.
public static Task InstallPostgreSQL(AppSettings appSettings)
Parameters
appSettingsAppSettingsApplication settings for database configuration.
Returns
IsPostgreSQLInstalledAsync()
Returns true if the pg_isready or psql binary is accessible, indicating PostgreSQL is installed.
public static Task<bool> IsPostgreSQLInstalledAsync()