Skip to content

Commit 883c997

Browse files
David EllingsworthDavid Ellingsworth
authored andcommitted
GH-3530: Add exception handler to handle cases when the table already exists.
Partially revert part of the previous commit which changed the responisbility of the SchemaExporter. Hopefully this fixes failing tests due to schema issues.
1 parent bb2e0c7 commit 883c997

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/NHibernate.Test/NHSpecificTest/GH3530/Fixture.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@ protected override void OnTearDown()
3838

3939
protected override void CreateSchema()
4040
{
41-
// Let the SchemaExporter drop and create tables if needed.
42-
base.CreateSchema();
43-
4441
CreateTable("Integer");
4542
CreateTable("DateTime");
4643
CreateTable("Double");
4744
CreateTable("Decimal");
45+
46+
base.CreateSchema();
4847
}
4948

5049
/// <summary>
@@ -83,6 +82,10 @@ private void CreateTable(string name)
8382
cmd.ExecuteNonQuery();
8483
}
8584
}
85+
catch (Exception ex)
86+
{
87+
Assert.Warn($"Creating the schema failed, assuming it already exists. {ex}");
88+
}
8689
finally
8790
{
8891
Sfi.ConnectionProvider.CloseConnection(cn);

src/NHibernate.Test/NHSpecificTest/GH3530/Mappings.hbm.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
not provide a mechanism of doing this, hence they have a
88
schema-action of 'none'.
99
-->
10-
<class name="IntegerEntity" schema-action="drop">
10+
<class name="IntegerEntity" schema-action="none">
1111
<id name="Id" generator="guid.comb" />
1212
<property name="DataValue" column="DataValue"/>
1313
</class>
14-
<class name="DateTimeEntity" schema-action="drop">
14+
<class name="DateTimeEntity" schema-action="none">
1515
<id name="Id" generator="guid.comb" />
1616
<property name="DataValue" column="DataValue"/>
1717
</class>
18-
<class name="DoubleEntity" schema-action="drop">
18+
<class name="DoubleEntity" schema-action="none">
1919
<id name="Id" generator="guid.comb" />
2020
<property name="DataValue" column="DataValue"/>
2121
</class>
22-
<class name="DecimalEntity" schema-action="drop">
22+
<class name="DecimalEntity" schema-action="none">
2323
<id name="Id" generator="guid.comb" />
2424
<property name="DataValue" column="DataValue"/>
2525
</class>

0 commit comments

Comments
 (0)