Skip to content

Commit 5aef4a5

Browse files
committed
minor #14130 Change the way to create table in Lock PDO (jderusse)
This PR was merged into the master branch. Discussion ---------- Change the way to create table in Lock PDO fixes #14127 Documentation for symfony/symfony#37926 This is inspired by https://github.com/symfony/symfony-docs/blame/master/components/cache/adapters/pdo_doctrine_dbal_adapter.rst#L34-L39 Commits ------- 27f13a8 Change the way to create table in Lock PDO
2 parents c1f5fe4 + 27f13a8 commit 5aef4a5

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

components/lock.rst

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -350,25 +350,11 @@ support blocking, and expects a TTL to avoid stalled locks::
350350

351351
This store does not support TTL lower than 1 second.
352352

353-
Before storing locks in the database, you must create the table that stores
354-
the information. The store provides a method called
355-
:method:`Symfony\\Component\\Lock\\Store\\PdoStore::createTable`
356-
to set up this table for you according to the database engine used::
357-
358-
try {
359-
$store->createTable();
360-
} catch (\PDOException $exception) {
361-
// the table could not be created for some reason
362-
}
363-
364-
A great way to set up the table in production is to call the ``createTable()``
365-
method in your local computer and then generate a
366-
:ref:`database migration <doctrine-creating-the-database-tables-schema>`:
367-
368-
.. code-block:: terminal
369-
370-
$ php bin/console doctrine:migrations:diff
371-
$ php bin/console doctrine:migrations:migrate
353+
The table where values are stored is created automatically on the first call to
354+
the :method:`Symfony\\Component\\Lock\\Store\\PdoStore::save` method.
355+
You can also create this table explicitly by calling the
356+
:method:`Symfony\\Component\\Lock\\Store\\PdoStore::createTable` method in
357+
your code.
372358

373359
.. _lock-store-redis:
374360

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy