Skip to content

Commit faf05fa

Browse files
committed
Fixed some sql tests for PostgreSQL
1 parent fa3651a commit faf05fa

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

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

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
// Copyright (C) 2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2010-2023 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Alexey Gamzov
55
// Created: 2010.01.23
66

7-
using System;
8-
using System.Diagnostics;
97
using System.Text;
108
using NUnit.Framework;
119
using Xtensive.Sql;
1210
using Xtensive.Sql.Dml;
1311
using Xtensive.Sql.Drivers.PostgreSql.v8_0;
14-
using Xtensive.Sql.Model;
1512

1613
namespace Xtensive.Orm.Tests.Sql.PostgreSql
1714
{
1815
public class ExtractorTest: ExtractorTestBase
1916
{
2017
protected override bool CheckContstraintExtracted => true;
21-
protected override bool SeqStartEqualsToMin => true;
2218

2319
protected override void CheckRequirements() => Require.ProviderIs(StorageProvider.PostgreSql);
2420

@@ -89,12 +85,12 @@ protected override string GetForeignKeyExtractionPrepareScript()
8985
" REFERENCES \"B3\" (\"b_id_1\", \"b_id_2\", \"b_id_3\") ON DELETE NO ACTION ON UPDATE CASCADE);";
9086
}
9187
protected override string GetForeignKeyExtractionCleanUpScript() =>
92-
"drop table \"A1\"" +
93-
"\n drop table \"A2\"" +
94-
"\n drop table \"A3\"" +
95-
"\n drop table \"B1\"" +
96-
"\n drop table \"B2\"" +
97-
"\n drop table \"B3\"";
88+
"drop table \"A1\";" +
89+
"\n drop table \"A2\";" +
90+
"\n drop table \"A3\";" +
91+
"\n drop table \"B1\";" +
92+
"\n drop table \"B2\";" +
93+
"\n drop table \"B3\";";
9894

9995
protected override string GetIndexExtractionPrepareScript(string tableName)
10096
{
@@ -172,25 +168,33 @@ public void ExtractDateTimeOffsetFields()
172168
var testTable = defaultSchema.Tables["InteractionLog"];
173169
var tableColumn = testTable.TableColumns["DateTimeOffset0"];
174170
Assert.That(tableColumn.DataType.Type, Is.EqualTo(SqlType.DateTimeOffset));
175-
Assert.That(tableColumn.DefaultValue, Is.EqualTo(new SqlNative("'0001-01-01 00:00:00+00:00'::timestamp(0) with time zone")));
171+
Assert.That(tableColumn.DefaultValue, Is.InstanceOf<SqlNative>());
172+
var defaultExpression = (SqlNative) tableColumn.DefaultValue;
173+
Assert.That(defaultExpression.Value, Is.EqualTo("'0001-01-01 04:02:33+04:02:33'::timestamp(0) with time zone"));
176174

177175
tableColumn = testTable.TableColumns["DateTimeOffset1"];
178176
Assert.That(tableColumn.DataType.Type, Is.EqualTo(SqlType.DateTimeOffset));
179-
Assert.That(tableColumn.DefaultValue, Is.EqualTo(new SqlNative("'0001-01-01 00:00:00.0+00:00'::timestamp(1) with time zone")));
177+
Assert.That(tableColumn.DefaultValue, Is.InstanceOf<SqlNative>());
178+
defaultExpression = (SqlNative) tableColumn.DefaultValue;
179+
Assert.That(defaultExpression.Value, Is.EqualTo("'0001-01-01 04:02:33+04:02:33'::timestamp(1) with time zone"));
180180

181181
tableColumn = testTable.TableColumns["DateTimeOffset2"];
182182
Assert.That(tableColumn.DataType.Type, Is.EqualTo(SqlType.DateTimeOffset));
183-
Assert.That(tableColumn.DefaultValue, Is.EqualTo(new SqlNative("'0001-01-01 00:00:00.00+00:00'::timestamp(2) with time zone")));
183+
Assert.That(tableColumn.DefaultValue, Is.InstanceOf<SqlNative>());
184+
defaultExpression = (SqlNative) tableColumn.DefaultValue;
185+
Assert.That(defaultExpression.Value, Is.EqualTo("'0001-01-01 04:02:33+04:02:33'::timestamp(2) with time zone"));
184186

185187
tableColumn = testTable.TableColumns["DateTimeOffset3"];
186188
Assert.That(tableColumn.DataType.Type, Is.EqualTo(SqlType.DateTimeOffset));
187-
Assert.That(tableColumn.DefaultValue, Is.EqualTo(new SqlNative("'0001-01-01 00:00:00.000+00:00'::timestamp(3) with time zone")));
189+
Assert.That(tableColumn.DefaultValue, Is.InstanceOf<SqlNative>());
190+
defaultExpression = (SqlNative) tableColumn.DefaultValue;
191+
Assert.That(defaultExpression.Value, Is.EqualTo("'0001-01-01 04:02:33+04:02:33'::timestamp(3) with time zone"));
188192
}
189193

190194

191195
protected virtual string GetExpressionIndexExtractorPrepareScript(string tableName)
192196
{
193-
return $"CREATE TABLE \" {tableName} \"(col1 text, col2 text);" +
197+
return $"CREATE TABLE \"{tableName}\"(col1 text, col2 text);" +
194198
$"CREATE INDEX \"{tableName}_indx\" ON \"" + tableName + "\"(col1,col2,(col1||col2));";
195199
}
196200

0 commit comments

Comments
 (0)