Skip to content

Commit 9ccc361

Browse files
committed
Fix error in sql command and handled Pgsql indexed column drop
1 parent 7c42791 commit 9ccc361

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Orm/Xtensive.Orm.Tests.Sql/PostgreSql/ExtractorTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected override string GetIndexExtractionPrepareScript(string tableName)
101101
$"CREATE TABLE \"{tableName}\" (\"column1\" int, \"column2\" int);" +
102102
$"\n CREATE INDEX \"{tableName}_index1_desc_asc\" on \"{tableName}\" (\"column1\" desc, \"column2\" asc);" +
103103
$"\n CREATE UNIQUE INDEX \"{tableName}_index1_u_asc_desc\" on \"{tableName}\" (\"column1\" asc, \"column2\" desc);" +
104-
$"\n CREATE UNIQUE INDEX \"{tableName}_index_with_included_columns\" on \"{tableName}\" (\"column1\" asc) include \"column2\");";
104+
$"\n CREATE UNIQUE INDEX \"{tableName}_index_with_included_columns\" on \"{tableName}\" (\"column1\" asc) include (\"column2\");";
105105
}
106106
else {
107107
return

Orm/Xtensive.Orm.Tests/Storage/IgnoreRulesValidateTest.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ public class IgnoreRulesValidateTest
344344

345345
private readonly bool createConstraintsWithTable = StorageProviderInfo.Instance.Provider == StorageProvider.Sqlite;
346346
private readonly bool noExceptionOnIndexKeyColumnDrop = StorageProviderInfo.Instance.Provider.In(StorageProvider.PostgreSql, StorageProvider.MySql);
347+
private readonly bool noExceptionOnIndexIncludedColumnDrop = StorageProviderInfo.Instance.Provider.In(StorageProvider.PostgreSql);
347348
private readonly SqlDriver sqlDriver = TestSqlDriver.Create(GetConnectionInfo());
348349

349350
private Key changedOrderKey;
@@ -646,8 +647,13 @@ public void DropIncludedColumnOfIgnoredIndexTest()
646647
var ignoreRuleCollection = new IgnoreRuleCollection();
647648
_ = ignoreRuleCollection.IgnoreIndex("IX_Ignored_Index").WhenTable("MyEntity2");
648649

649-
_ = Assert.Throws<StorageException>(
650-
() => BuildDomain(DomainUpgradeMode.Perform, ignoreRuleCollection, model5Types).Dispose());
650+
if (noExceptionOnIndexIncludedColumnDrop) {
651+
BuildDomain(DomainUpgradeMode.Perform, ignoreRuleCollection, model6Types).Dispose();
652+
}
653+
else {
654+
_ = Assert.Throws<StorageException>(
655+
() => BuildDomain(DomainUpgradeMode.Perform, ignoreRuleCollection, model5Types).Dispose());
656+
}
651657
}
652658

653659
[Test]

0 commit comments

Comments
 (0)