6#include "SqlConnection.hpp"
12namespace Lightweight::SqlMigration
43 std::string_view lockName =
"lightweight_migration",
44 std::chrono::milliseconds timeout = std::chrono::seconds(30));
74 std::string _lockName;
75 bool _locked {
false };
77 void AcquireLock(std::chrono::milliseconds timeout);
80 void AcquireLockSqlServer(std::chrono::milliseconds timeout);
81 void ReleaseLockSqlServer();
83 void AcquireLockPostgreSQL(std::chrono::milliseconds timeout);
84 void ReleaseLockPostgreSQL();
86 void AcquireLockSQLite(std::chrono::milliseconds timeout);
87 void ReleaseLockSQLite();
Represents a connection to a SQL database.
bool IsLocked() const noexcept
LIGHTWEIGHT_API void Release()
LIGHTWEIGHT_API ~MigrationLock()
Releases the lock on destruction.
LIGHTWEIGHT_API MigrationLock(MigrationLock &&other) noexcept
Move constructor.
LIGHTWEIGHT_API MigrationLock & operator=(MigrationLock &&other) noexcept
Move assignment operator.
LIGHTWEIGHT_API MigrationLock(SqlConnection &connection, std::string_view lockName="lightweight_migration", std::chrono::milliseconds timeout=std::chrono::seconds(30))