function PdoStore::createTable
Creates the table to store lock keys which can be called once for setup.
Throws
\PDOException When the table already exists
\DomainException When an unsupported PDO driver is used
1 call to PdoStore::createTable()
- PdoStore::save in vendor/
symfony/ lock/ Store/ PdoStore.php - Stores the resource if it's not locked by someone else.
File
-
vendor/
symfony/ lock/ Store/ PdoStore.php, line 188
Class
- PdoStore
- PdoStore is a PersistingStoreInterface implementation using a PDO connection.
Namespace
Symfony\Component\Lock\StoreCode
public function createTable() : void {
$sql = match ($driver = $this->getDriver()) { 'mysql' => "CREATE TABLE {$this->table} ({$this->idCol} VARCHAR(64) NOT NULL PRIMARY KEY, {$this->tokenCol} VARCHAR(44) NOT NULL, {$this->expirationCol} INTEGER UNSIGNED NOT NULL) COLLATE utf8mb4_bin, ENGINE = InnoDB",
'sqlite' => "CREATE TABLE {$this->table} ({$this->idCol} TEXT NOT NULL PRIMARY KEY, {$this->tokenCol} TEXT NOT NULL, {$this->expirationCol} INTEGER)",
'pgsql' => "CREATE TABLE {$this->table} ({$this->idCol} VARCHAR(64) NOT NULL PRIMARY KEY, {$this->tokenCol} VARCHAR(64) NOT NULL, {$this->expirationCol} INTEGER)",
'oci' => "CREATE TABLE {$this->table} ({$this->idCol} VARCHAR2(64) NOT NULL PRIMARY KEY, {$this->tokenCol} VARCHAR2(64) NOT NULL, {$this->expirationCol} INTEGER)",
'sqlsrv' => "CREATE TABLE {$this->table} ({$this->idCol} VARCHAR(64) NOT NULL PRIMARY KEY, {$this->tokenCol} VARCHAR(64) NOT NULL, {$this->expirationCol} INTEGER)",
default => throw new \DomainException(\sprintf('Creating the lock table is currently not implemented for platform "%s".', $driver)),
};
$this->getConnection()
->exec($sql);
}