16
16
use Magento \Framework \Config \ConfigOptionsListConstants ;
17
17
use Magento \Framework \Config \Data \ConfigData ;
18
18
use Magento \Framework \Config \File \ConfigFilePool ;
19
+ use Magento \Framework \DB \Adapter \AdapterInterface ;
19
20
use Magento \Framework \DB \Adapter \Pdo \Mysql ;
20
21
use Magento \Framework \Exception \FileSystemException ;
21
22
use Magento \Framework \Filesystem ;
@@ -603,7 +604,7 @@ private function setupModuleRegistry(SchemaSetupInterface $setup)
603
604
*/
604
605
private function setupCoreTables (SchemaSetupInterface $ setup )
605
606
{
606
- /* @var $connection \Magento\Framework\DB\Adapter\ AdapterInterface */
607
+ /* @var $connection AdapterInterface */
607
608
$ connection = $ setup ->getConnection ();
608
609
$ setup ->startSetup ();
609
610
@@ -619,12 +620,12 @@ private function setupCoreTables(SchemaSetupInterface $setup)
619
620
* Create table 'session'
620
621
*
621
622
* @param SchemaSetupInterface $setup
622
- * @param \Magento\Framework\DB\Adapter\ AdapterInterface $connection
623
+ * @param AdapterInterface $connection
623
624
* @return void
624
625
*/
625
626
private function setupSessionTable (
626
627
SchemaSetupInterface $ setup ,
627
- \ Magento \ Framework \ DB \ Adapter \ AdapterInterface $ connection
628
+ AdapterInterface $ connection
628
629
) {
629
630
if (!$ connection ->isTableExists ($ setup ->getTable ('session ' ))) {
630
631
$ table = $ connection ->newTable (
@@ -658,12 +659,12 @@ private function setupSessionTable(
658
659
* Create table 'cache'
659
660
*
660
661
* @param SchemaSetupInterface $setup
661
- * @param \Magento\Framework\DB\Adapter\ AdapterInterface $connection
662
+ * @param AdapterInterface $connection
662
663
* @return void
663
664
*/
664
665
private function setupCacheTable (
665
666
SchemaSetupInterface $ setup ,
666
- \ Magento \ Framework \ DB \ Adapter \ AdapterInterface $ connection
667
+ AdapterInterface $ connection
667
668
) {
668
669
if (!$ connection ->isTableExists ($ setup ->getTable ('cache ' ))) {
669
670
$ table = $ connection ->newTable (
@@ -712,12 +713,12 @@ private function setupCacheTable(
712
713
* Create table 'cache_tag'
713
714
*
714
715
* @param SchemaSetupInterface $setup
715
- * @param \Magento\Framework\DB\Adapter\ AdapterInterface $connection
716
+ * @param AdapterInterface $connection
716
717
* @return void
717
718
*/
718
719
private function setupCacheTagTable (
719
720
SchemaSetupInterface $ setup ,
720
- \ Magento \ Framework \ DB \ Adapter \ AdapterInterface $ connection
721
+ AdapterInterface $ connection
721
722
) {
722
723
if (!$ connection ->isTableExists ($ setup ->getTable ('cache_tag ' ))) {
723
724
$ table = $ connection ->newTable (
@@ -748,12 +749,12 @@ private function setupCacheTagTable(
748
749
* Create table 'flag'
749
750
*
750
751
* @param SchemaSetupInterface $setup
751
- * @param \Magento\Framework\DB\Adapter\ AdapterInterface $connection
752
+ * @param AdapterInterface $connection
752
753
* @return void
753
754
*/
754
755
private function setupFlagTable (
755
756
SchemaSetupInterface $ setup ,
756
- \ Magento \ Framework \ DB \ Adapter \ AdapterInterface $ connection
757
+ AdapterInterface $ connection
757
758
) {
758
759
if (!$ connection ->isTableExists ($ setup ->getTable ('flag ' ))) {
759
760
$ table = $ connection ->newTable (
@@ -795,6 +796,8 @@ private function setupFlagTable(
795
796
'Flag '
796
797
);
797
798
$ connection ->createTable ($ table );
799
+ } else {
800
+ $ this ->updateColumnType ($ connection , 'flag ' , 'flag_data ' , 'mediumtext ' );
798
801
}
799
802
}
800
803
@@ -1548,4 +1551,28 @@ function ($value, $key) {
1548
1551
1549
1552
return !empty ($ adminData );
1550
1553
}
1554
+
1555
+ /**
1556
+ * Update flag_data column data type to maintain consistency.
1557
+ *
1558
+ * @param AdapterInterface $connection
1559
+ * @param string $tableName
1560
+ * @param string $columnName
1561
+ * @param string $typeName
1562
+ */
1563
+ private function updateColumnType (
1564
+ AdapterInterface $ connection ,
1565
+ string $ tableName ,
1566
+ string $ columnName ,
1567
+ string $ typeName
1568
+ ): void {
1569
+ $ tableDescription = $ connection ->describeTable ($ tableName );
1570
+ if ($ tableDescription [$ columnName ]['DATA_TYPE ' ] !== $ typeName ) {
1571
+ $ connection ->modifyColumn (
1572
+ $ tableName ,
1573
+ $ columnName ,
1574
+ $ typeName
1575
+ );
1576
+ }
1577
+ }
1551
1578
}
0 commit comments