diff --git a/src/Migrations/PimcoreX/Version20230124103907.php b/src/Migrations/PimcoreX/Version20230124103907.php index 63f6e29..e4a4e9c 100644 --- a/src/Migrations/PimcoreX/Version20230124103907.php +++ b/src/Migrations/PimcoreX/Version20230124103907.php @@ -35,23 +35,27 @@ public function up(Schema $schema): void { $table = $schema->getTable(Dao::TABLE_NAME); - $this->addSql(sprintf( - 'ALTER TABLE `%s` RENAME COLUMN `%s` TO `%s`', - $table->getName(), - 'o_classId', - 'classId' - )); + if ($table->hasColumn('o_classId')) { + $this->addSql(sprintf( + 'ALTER TABLE `%s` RENAME COLUMN `%s` TO `%s`', + $table->getName(), + 'o_classId', + 'classId' + )); + } } public function down(Schema $schema): void { $table = $schema->getTable(Dao::TABLE_NAME); - $this->addSql(sprintf( - 'ALTER TABLE `%s` RENAME COLUMN `%s` TO `%s`', - $table->getName(), - 'classId', - 'o_classId' - )); + if ($table->hasColumn('classId')) { + $this->addSql(sprintf( + 'ALTER TABLE `%s` RENAME COLUMN `%s` TO `%s`', + $table->getName(), + 'classId', + 'o_classId' + )); + } } }