@@ -880,7 +880,13 @@ Preparing the Database to Store Sessions
880
880
........................................
881
881
882
882
Before storing sessions in the database, you must create the table that stores
883
- the information. The session handler provides a method called
883
+ the information.
884
+
885
+ With Doctrine installed, the session table will be automatically generated when
886
+ you run the make:migration command if the database targeted by doctrine is identical to
887
+ the one used by this component.
888
+
889
+ Or if you prefer to create the table yourself and the table has not already been created, the session handler provides a method called
884
890
:method: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Handler\\ PdoSessionHandler::createTable `
885
891
to set up this table for you according to the database engine used::
886
892
@@ -890,7 +896,9 @@ to set up this table for you according to the database engine used::
890
896
// the table could not be created for some reason
891
897
}
892
898
893
- If you prefer to set up the table yourself, it's recommended to generate an
899
+ If the table already exists an exception will be thrown.
900
+
901
+ If you would rather set up the table yourself, it's recommended to generate an
894
902
empty database migration with the following command:
895
903
896
904
.. code-block :: terminal
@@ -904,6 +912,10 @@ file and run the migration with the following command:
904
912
905
913
$ php bin/console doctrine:migrations:migrate
906
914
915
+ If needed, you can also add this table to your schema by calling
916
+ :method: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Storage\\ Handler\\ PdoSessionHandler::configureSchema ` method
917
+ in your code.
918
+
907
919
.. _mysql :
908
920
909
921
MariaDB/MySQL
0 commit comments