Skip to content

Commit

Permalink
fix table name when exec query
Browse files Browse the repository at this point in the history
change author
  • Loading branch information
De Abreu Freitas, Alex authored and dvesh3 committed Jul 6, 2023
1 parent a41bccf commit 70c8584
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Migrations/PimcoreX/Version20221130130306.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ public function getDescription(): string

public function up(Schema $schema): void
{
$table = $schema->getTable(Installer::QUEUE_TABLE_NAME)->getName();
$table = $schema->getTable(Installer::QUEUE_TABLE_NAME);
if ($table->hasColumn('o_id')) {
$query = 'ALTER TABLE %s CHANGE COLUMN `o_id` `id` bigint DEFAULT 0 NOT NULL;';
$this->addSql(sprintf($query, $table));
$this->addSql(sprintf($query, $table->getName()));
}
}

public function down(Schema $schema): void
{
$table = $schema->getTable(Installer::QUEUE_TABLE_NAME)->getName();
$table = $schema->getTable(Installer::QUEUE_TABLE_NAME);
if ($table->hasColumn('id')) {
$query = 'ALTER TABLE %s CHANGE COLUMN `id` `o_id` bigint DEFAULT 0 NOT NULL;';
$this->addSql(sprintf($query, $table));
$this->addSql(sprintf($query, $table->getName()));
}
}
}

0 comments on commit 70c8584

Please sign in to comment.