Make database connection lazy and adjust config execution order

This commit is contained in:
2025-08-21 15:00:10 +03:00
parent f4fefb3391
commit d26587cfc3
8 changed files with 129 additions and 173 deletions

View File

@@ -15,16 +15,6 @@ public protocol MigrationServiceProtocol: AnyObject, Sendable {
/// Encryption key provider for the database service.
var keyProvider: DatabaseServiceKeyProvider? { get set }
/// Applies an encryption key to the current database connection.
///
/// - Throws: Any error that occurs while retrieving or applying the key.
func applyKeyProvider() throws
/// Recreates the database connection and reapplies the encryption key if available.
///
/// - Throws: Any error that occurs while creating the connection or applying the key.
func reconnect() throws
/// Registers a migration to be executed by the service.
///
/// - Parameter migration: The migration to register.