From 31769bb0efe72755c13444ec2bc67cafaab9962d Mon Sep 17 00:00:00 2001 From: vgelani Date: Fri, 19 Oct 2018 15:31:17 +0530 Subject: [PATCH 1/2] Fixed value of columns not updating in ui_bookmark table --- app/code/Magento/Ui/Setup/UpgradeSchema.php | 58 +++++++++++++++++++++ app/code/Magento/Ui/etc/module.xml | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Ui/Setup/UpgradeSchema.php diff --git a/app/code/Magento/Ui/Setup/UpgradeSchema.php b/app/code/Magento/Ui/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..d8bf4e7633339 --- /dev/null +++ b/app/code/Magento/Ui/Setup/UpgradeSchema.php @@ -0,0 +1,58 @@ +startSetup(); + + if (version_compare($context->getVersion(), '2.0.1', '<')) { + $setup->getConnection()->dropColumn($setup->getTable('ui_bookmark'), 'created_at'); + $setup->getConnection()->dropColumn($setup->getTable('ui_bookmark'), 'updated_at'); + $tableName = $setup->getTable('ui_bookmark'); + if ($setup->getConnection()->isTableExists($tableName) == true) { + $columns = [ + 'created_at' => [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + 'nullable' => false, + 'comment' => 'Bookmark created at', + 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT + ], + 'updated_at' => [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + 'nullable' => false, + 'comment' => 'Bookmark updated at', + 'default' => \Magento\Framework\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE + ] + ]; + $connection = $setup->getConnection(); + + foreach ($columns as $name => $definition) { + $connection->addColumn($tableName, $name, $definition); + } + } + } + + $setup->endSetup(); + } +} diff --git a/app/code/Magento/Ui/etc/module.xml b/app/code/Magento/Ui/etc/module.xml index 20bd9de1567ee..1f22ed89c8612 100644 --- a/app/code/Magento/Ui/etc/module.xml +++ b/app/code/Magento/Ui/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + From 08a95045386c38aed6cb004e4847695aba57bfe9 Mon Sep 17 00:00:00 2001 From: Vishal Gelani Date: Sat, 20 Oct 2018 10:09:00 +0530 Subject: [PATCH 2/2] Updated column types --- app/code/Magento/Ui/Setup/UpgradeSchema.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/Ui/Setup/UpgradeSchema.php b/app/code/Magento/Ui/Setup/UpgradeSchema.php index d8bf4e7633339..a6331003fb198 100644 --- a/app/code/Magento/Ui/Setup/UpgradeSchema.php +++ b/app/code/Magento/Ui/Setup/UpgradeSchema.php @@ -27,8 +27,6 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $setup->startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { - $setup->getConnection()->dropColumn($setup->getTable('ui_bookmark'), 'created_at'); - $setup->getConnection()->dropColumn($setup->getTable('ui_bookmark'), 'updated_at'); $tableName = $setup->getTable('ui_bookmark'); if ($setup->getConnection()->isTableExists($tableName) == true) { $columns = [ @@ -48,7 +46,7 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $connection = $setup->getConnection(); foreach ($columns as $name => $definition) { - $connection->addColumn($tableName, $name, $definition); + $connection->modifyColumn($tableName, $name, $definition); } } }