Table of Contents

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

appSettings AppSettings

Returns

Task

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

superUsername string

PostgreSQL superuser name.

superPassword string

PostgreSQL superuser password.

appSettings AppSettings

Application settings for database configuration.

Returns

Task

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

superUsername string

PostgreSQL superuser name.

superPassword string

PostgreSQL superuser password.

appSettings AppSettings

Application settings for database configuration.

appUsername string

Returns

Task

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

connection NpgsqlConnection
appSettings AppSettings

Returns

Task

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

superUsername string

PostgreSQL superuser name.

superPassword string

PostgreSQL superuser password.

appSettings AppSettings

Application settings for database configuration.

Returns

Task

InstallPostgreSQL(AppSettings)

Installs PostgreSQL on the current platform by dispatching to the appropriate platform-specific method.

public static Task InstallPostgreSQL(AppSettings appSettings)

Parameters

appSettings AppSettings

Application settings for database configuration.

Returns

Task

IsPostgreSQLInstalledAsync()

Returns true if the pg_isready or psql binary is accessible, indicating PostgreSQL is installed.

public static Task<bool> IsPostgreSQLInstalledAsync()

Returns

Task<bool>