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
Prev Previous commit
Next Next commit
add test case
  • Loading branch information
Felix Geyer committed Aug 22, 2022
commit 009a568707db63d77f5a0169e13ebf31e4725c38
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Map\MyOldArchivableTest3TableMap;
use Propel\Generator\Util\QuickBuilder;
use Propel\Tests\TestCase;
use function substr_count;

/**
* Tests for ArchivableBehavior class
Expand Down Expand Up @@ -83,6 +84,9 @@ public function setUp(): void
<unique>
<unique-column name="title"/>
</unique>
<index>
<index-column name="title"/>
</index>
<behavior name="archivable">
<parameter name="log_archived_at" value="false"/>
<parameter name="archive_table" value="my_old_archivable_test_3"/>
Expand Down Expand Up @@ -208,6 +212,15 @@ public function testCopiesUniquesToIndices()
$this->assertStringContainsString($expected, self::$generatedSQL);
}

/**
* @return void
*/
public function testCopiedUniqueDoesNotDuplicateCopiedIndex()
{
$expectedSqlMigration = 'CREATE INDEX my_old_archivable_test_3_i_639136 ON my_old_archivable_test_3 (title);';
$this->assertEquals(1, substr_count(self::$generatedSQL, $expectedSqlMigration));
dereuromark marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* @return void
*/
Expand Down