Skip to main content

GravityKit\GravityMigrate\Migration\RunLock

One migration run at a time, through MySQL's GET_LOCK().

A retry sent while the first run is still writing would otherwise create the forms the first run has not reached yet. MySQL ties the lock to the request's database connection and frees it when that connection ends, even after a crash, so there is no stored lock to expire or clear.

Since: 2.1.2

Source: src/Migration/RunLock.php:19

Details​

  • Kind: class
  • Namespace: GravityKit\GravityMigrate\Migration

Methods​

MethodDescription
acquire()Takes the lock without waiting.
release()Releases the lock this request holds.
name()The lock's full name on the database server.

Method Reference​

acquire()​

public static function acquire(): ?bool

Takes the lock without waiting.

Returns​

  • bool | null — True when this request now holds it, false when another request does, null when MySQL could not take it at all.

Since: 2.1.2

Source: src/Migration/RunLock.php:36

release()​

public static function release(): void

Releases the lock this request holds.

Returns​

  • void

Since: 2.1.2

Source: src/Migration/RunLock.php:55

name()​

public static function name(): string

The lock's full name on the database server.

Returns​

  • string

Since: 2.1.2

Source: src/Migration/RunLock.php:68