class DatabaseRequirements

Database engine version requirements for this Flarum version.

Two tiers per engine: - MINIMUM: below this Flarum will not run. The installer refuses to proceed and the admin dashboard shows a blocking error. - RECOMMENDED: above the minimum but below this runs, but the admin is warned to encourage upgrading to a modern, supported release. Centralised here so the installer, `ApplicationInfoProvider` and the admin surfaces share a single source of truth.

Constants

MYSQL_MINIMUM

Minimum MySQL version. The `JSON` column type, which Flarum relies on, was introduced in MySQL 5.7.8.

MYSQL_RECOMMENDED

Recommended MySQL version — a modern, supported release.

MARIADB_MINIMUM

Minimum MariaDB version. While JSON support arrived in 10.2.7, Flarum's migrations require features present from 10.3 onwards.

MARIADB_RECOMMENDED

Recommended MariaDB version — a modern, supported release.

PGSQL_MINIMUM

PGSQL_RECOMMENDED

Recommended PostgreSQL version. PostgreSQL supports each major release for five years; below this a release is (or is about to be) end-of-life, so we warn to encourage staying on a maintained release.

SQLITE_MINIMUM

IDENTIFIER_LIMITS

How long an identifier each driver accepts. MySQL and MariaDB count characters; PostgreSQL counts bytes. SQLite imposes no practical limit.

LONGEST_MIGRATION_IDENTIFIER

Length of the longest index or foreign key name any migration in core or the bundled extensions generates, currently `dialog_message_mentions_group_dialog_message_id_foreign` from flarum/messages.

Laravel prepends the table prefix to generated index and foreign key names as well as to table names, so this plus the prefix has to fit inside the driver's limit. Because migrations are immutable and a new installation replays all of them, this is set by migration history rather than by the current schema — renaming a table later does not change it. flarum/testing asserts this against the migrations actually being run, so a migration introducing a longer name fails there rather than in someone's installation.

OK

The result of comparing a version against the tiers.

BELOW_MINIMUM

BELOW_RECOMMENDED

Methods

static int|null
maxTablePrefixLength(string $driver)

Longest table prefix, in bytes, that leaves room for every identifier the migrations generate. Null where the driver has no meaningful limit.

static bool
isMariaDb(string $rawVersion)

Whether a raw `VERSION()` string reports a MariaDB server.

static string|null
normaliseVersion(string $rawVersion, bool $isMariaDb)

Extract a dotted numeric version (e.g. "8.0.36" or "11.8.2") from a raw `VERSION()` string.

static array
mysqlFamilyTiers(bool $isMariaDb)

The minimum and recommended versions for a MySQL/MariaDB server.

static string
compare(string $version, string $minimum, string $recommended)

Compare a normalised version against a tier pair.

Details

static int|null maxTablePrefixLength(string $driver)

Longest table prefix, in bytes, that leaves room for every identifier the migrations generate. Null where the driver has no meaningful limit.

Parameters

string $driver

Return Value

int|null

static bool isMariaDb(string $rawVersion)

Whether a raw `VERSION()` string reports a MariaDB server.

Parameters

string $rawVersion

Return Value

bool

static string|null normaliseVersion(string $rawVersion, bool $isMariaDb)

Extract a dotted numeric version (e.g. "8.0.36" or "11.8.2") from a raw `VERSION()` string.

MariaDB reports itself with a legacy "5.5.5-" compatibility prefix in some configurations (e.g. "5.5.5-10.11.6-MariaDB-..."). We strip that prefix before parsing so we read the real MariaDB version. The third segment is optional: since PostgreSQL 10, `SHOW server_version` reports a two-part `major.minor` string (e.g. "16.3"). MySQL and MariaDB always report all three parts, which the greedy match still captures.

Parameters

string $rawVersion
bool $isMariaDb

Return Value

string|null

static array mysqlFamilyTiers(bool $isMariaDb)

The minimum and recommended versions for a MySQL/MariaDB server.

Parameters

bool $isMariaDb

Return Value

array

static string compare(string $version, string $minimum, string $recommended)

Compare a normalised version against a tier pair.

Parameters

string $version
string $minimum
string $recommended

Return Value

string