diff --git a/src/Sample/Program.cs b/src/Sample/Program.cs
index e825c6d..abc1013 100644
--- a/src/Sample/Program.cs
+++ b/src/Sample/Program.cs
@@ -1,4 +1,5 @@
using System;
+using Microsoft.Data.Sqlite;
namespace SqliteSampleApplication
{
@@ -55,7 +56,7 @@ static void TemporaryFileDb()
static void PermanentFileDb()
{
- Microsoft.Data.Sqlite.SqliteConnection connection = new("Data Source=dbup.db");
+ SqliteConnection connection = new("Data Source=dbup.db");
using (var database = new DbUp.Sqlite.Helpers.SharedConnection(connection))
{
diff --git a/src/Sample/Sample.csproj b/src/Sample/Sample.csproj
index ad8a65c..238a0ef 100644
--- a/src/Sample/Sample.csproj
+++ b/src/Sample/Sample.csproj
@@ -7,6 +7,7 @@
+
diff --git a/src/Tests/SqliteSupportTests.cs b/src/Tests/SqliteSupportTests.cs
index b1880bc..679bd1f 100644
--- a/src/Tests/SqliteSupportTests.cs
+++ b/src/Tests/SqliteSupportTests.cs
@@ -1,17 +1,16 @@
-using Microsoft.Data.Sqlite;
-using Shouldly;
+using Shouldly;
using Xunit;
namespace DbUp.Sqlite.Tests
{
public class SqliteSupportTests
{
- static readonly string dbFilePath = Path.Combine(Environment.CurrentDirectory, "test.db");
+ static readonly string DbFilePath = Path.Combine(Environment.CurrentDirectory, "test.db");
[Fact]
public void CanUseSQLite()
{
- var connectionString = $"Data Source={dbFilePath}";
+ var connectionString = $"Data Source={DbFilePath}";
var upgrader = DeployChanges.To
.SqliteDatabase(connectionString)
@@ -23,5 +22,28 @@ public void CanUseSQLite()
result.Error.ShouldBe(null);
result.Successful.ShouldBe(true);
}
+
+ ///
+ /// Test for https://github.com/DbUp/dbup-sqlite/issues/2
+ ///
+ [Fact]
+ public void DoesNotExhibitSafeHandleError()
+ {
+ var connectionString = "Data source=:memory:";
+
+ var upgrader =
+ DeployChanges.To
+ .SQLiteDatabase(connectionString)
+ .WithScript("Script001", @"
+create table test (
+ contact_id INTEGER PRIMARY KEY
+);
+")
+ .LogScriptOutput()
+ .LogToConsole()
+ .Build();
+ var result = upgrader.PerformUpgrade();
+ result.Successful.ShouldBeTrue();
+ }
}
}
diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj
index 0935f6e..fde43b2 100644
--- a/src/Tests/Tests.csproj
+++ b/src/Tests/Tests.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/dbup-sqlite/Helpers/InMemorySqliteDatabase.cs b/src/dbup-sqlite/Helpers/InMemorySqliteDatabase.cs
index 1e65768..d4a3a38 100644
--- a/src/dbup-sqlite/Helpers/InMemorySqliteDatabase.cs
+++ b/src/dbup-sqlite/Helpers/InMemorySqliteDatabase.cs
@@ -23,6 +23,7 @@ public InMemorySqliteDatabase()
{
DataSource = ":memory:",
DefaultTimeout = 5,
+ Mode = SqliteOpenMode.Memory
};
ConnectionString = connectionStringBuilder.ToString();
diff --git a/src/dbup-sqlite/dbup-sqlite.csproj b/src/dbup-sqlite/dbup-sqlite.csproj
index 2b4c830..6c54d7f 100644
--- a/src/dbup-sqlite/dbup-sqlite.csproj
+++ b/src/dbup-sqlite/dbup-sqlite.csproj
@@ -24,7 +24,7 @@
-
+