Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate indices when converting unique index to index #1903

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix duplicate indices when converting unique index to index
  • Loading branch information
Felix Geyer committed Aug 22, 2022
commit 17519502df43dc9123a384baa859beb9992164d9
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,18 @@ protected function addArchiveTable(): void
// see https://github.com/propelorm/Propel/issues/175 for details
foreach ($table->getUnices() as $unique) {
$index = new Index();
$index->setTable($table);
$index->setTable($archiveTable);
foreach ($unique->getColumns() as $columnName) {
if ($size = $unique->getColumnSize($columnName)) {
$index->addColumn(['name' => $columnName, 'size' => $size]);
} else {
$index->addColumn(['name' => $columnName]);
}
}
$archiveTable->addIndex($index);

if (!$archiveTable->hasIndex($index->getName())) {
$archiveTable->addIndex($index);
}
}
// every behavior adding a table should re-execute database behaviors
foreach ($database->getBehaviors() as $behavior) {
Expand Down