Feature testing through Database::supports(Feature) #81

Closed
opened 2026-09-30 19:10:54 +02:00 by c.fahner · 0 comments
Owner

Currently the only feature that can be tested is schema enforcement using the SchemaEnforceable interface. However, there are many more schema-related features which databases can optionally support. Moreover, not all optional features are schema-related and in the future it might also become necessary to test for subfeatures. Which features are required or recommended also differs per application. A more general mechanism for feature testing needs to be made available.

The Database interface should instead have a runtime method supports(Database\Feature):bool, where Feature is an enum to which features can be added progressively.

Implementors may do a feature check during their regular database install/upgrade process.

This means SchemaEnforceable can be removed, to be replaced by Database::applySchema($collectionName, $schema):UpgradeCommand which just applies as many schema rules as it can.

Currently the only feature that can be tested is schema enforcement using the `SchemaEnforceable` interface. However, there are many more schema-related features which databases can optionally support. Moreover, not all optional features are schema-related and in the future it might also become necessary to test for subfeatures. Which features are required or recommended also differs per application. A more general mechanism for feature testing needs to be made available. The `Database` interface should instead have a runtime method `supports(Database\Feature):bool`, where `Feature` is an `enum` to which features can be added progressively. Implementors may do a feature check during their regular database install/upgrade process. This means `SchemaEnforceable` can be removed, to be replaced by `Database::applySchema($collectionName, $schema):UpgradeCommand` which just applies as many schema rules as it can.
c.fahner added this to the v0.2 milestone 2026-09-30 19:10:54 +02:00
c.fahner stopped working 2026-10-19 18:05:40 +02:00
39 minutes 39 seconds
c.fahner added spent time 2026-10-19 18:05:51 +02:00
20 minutes
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 59 minutes 39 seconds
c.fahner
59 minutes 39 seconds
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
slendium/ocd#81
No description provided.