Skip to content

Commit 7c42791

Browse files
committed
PostgreSql.ExtractorTest: Change test database structure to have included columns
1 parent de44d58 commit 7c42791

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,23 @@ protected override string GetForeignKeyExtractionCleanUpScript() =>
9292

9393
protected override string GetIndexExtractionPrepareScript(string tableName)
9494
{
95-
return
96-
$"CREATE TABLE \"{tableName}\" (\"column1\" int, \"column2\" int);" +
97-
$"\n CREATE INDEX \"{tableName}_index1_desc_asc\" on \"{tableName}\" (\"column1\" desc, \"column2\" asc);" +
98-
$"\n CREATE UNIQUE INDEX \"{tableName}_index1_u_asc_desc\" on \"{tableName}\" (\"column1\" asc, \"column2\" desc);";
95+
// CREATE TABLE table1 (column1 int, column2 int);
96+
// CREATE INDEX table1_index1_desc_asc on table1 (column1 desc, column2 asc);
97+
// CREATE UNIQUE INDEX table1_index1_u_asc_desc on table1 (column1 asc, column2 desc);
98+
// CREATE UNIQUE INDEX table1_index_with_included_columns on table1 (column1 asc) include (column2);
99+
if (NonKeyColumnsSupported) {
100+
return
101+
$"CREATE TABLE \"{tableName}\" (\"column1\" int, \"column2\" int);" +
102+
$"\n CREATE INDEX \"{tableName}_index1_desc_asc\" on \"{tableName}\" (\"column1\" desc, \"column2\" asc);" +
103+
$"\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\");";
105+
}
106+
else {
107+
return
108+
$"CREATE TABLE \"{tableName}\" (\"column1\" int, \"column2\" int);" +
109+
$"\n CREATE INDEX \"{tableName}_index1_desc_asc\" on \"{tableName}\" (\"column1\" desc, \"column2\" asc);" +
110+
$"\n CREATE UNIQUE INDEX \"{tableName}_index1_u_asc_desc\" on \"{tableName}\" (\"column1\" asc, \"column2\" desc);";
111+
}
99112
}
100113
protected override string GetIndexExtractionCleanUpScript(string tableName) => $"drop table \"{tableName}\";";
101114

0 commit comments

Comments
 (0)