File tree 6 files changed +32
-6
lines changed
6 files changed +32
-6
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using Microsoft . Data . Sqlite ;
2
3
3
4
namespace SqliteSampleApplication
4
5
{
@@ -55,7 +56,7 @@ static void TemporaryFileDb()
55
56
56
57
static void PermanentFileDb ( )
57
58
{
58
- Microsoft . Data . Sqlite . SqliteConnection connection = new ( "Data Source=dbup.db" ) ;
59
+ SqliteConnection connection = new ( "Data Source=dbup.db" ) ;
59
60
60
61
using ( var database = new DbUp . Sqlite . Helpers . SharedConnection ( connection ) )
61
62
{
Original file line number Diff line number Diff line change 7
7
8
8
<ItemGroup >
9
9
<ProjectReference Include =" ..\dbup-sqlite\dbup-sqlite.csproj" />
10
+ <PackageReference Include =" Microsoft.Data.Sqlite" Version =" 8.0.7" />
10
11
</ItemGroup >
11
12
12
13
<ItemGroup >
Original file line number Diff line number Diff line change 1
- using Microsoft . Data . Sqlite ;
2
- using Shouldly ;
1
+ using Shouldly ;
3
2
using Xunit ;
4
3
5
4
namespace DbUp . Sqlite . Tests
6
5
{
7
6
public class SqliteSupportTests
8
7
{
9
- static readonly string dbFilePath = Path . Combine ( Environment . CurrentDirectory , "test.db" ) ;
8
+ static readonly string DbFilePath = Path . Combine ( Environment . CurrentDirectory , "test.db" ) ;
10
9
11
10
[ Fact ]
12
11
public void CanUseSQLite ( )
13
12
{
14
- var connectionString = $ "Data Source={ dbFilePath } ";
13
+ var connectionString = $ "Data Source={ DbFilePath } ";
15
14
16
15
var upgrader = DeployChanges . To
17
16
. SqliteDatabase ( connectionString )
@@ -23,5 +22,28 @@ public void CanUseSQLite()
23
22
result . Error . ShouldBe ( null ) ;
24
23
result . Successful . ShouldBe ( true ) ;
25
24
}
25
+
26
+ /// <summary>
27
+ /// Test for https://github.com/DbUp/dbup-sqlite/issues/2
28
+ /// </summary>
29
+ [ Fact ]
30
+ public void DoesNotExhibitSafeHandleError ( )
31
+ {
32
+ var connectionString = "Data source=:memory:" ;
33
+
34
+ var upgrader =
35
+ DeployChanges . To
36
+ . SQLiteDatabase ( connectionString )
37
+ . WithScript ( "Script001" , @"
38
+ create table test (
39
+ contact_id INTEGER PRIMARY KEY
40
+ );
41
+ " )
42
+ . LogScriptOutput ( )
43
+ . LogToConsole ( )
44
+ . Build ( ) ;
45
+ var result = upgrader . PerformUpgrade ( ) ;
46
+ result . Successful . ShouldBeTrue ( ) ;
47
+ }
26
48
}
27
49
}
Original file line number Diff line number Diff line change 10
10
11
11
<ItemGroup >
12
12
<ProjectReference Include =" ..\dbup-sqlite\dbup-sqlite.csproj" />
13
+ <PackageReference Include =" Microsoft.Data.Sqlite" Version =" 8.0.7" />
13
14
<PackageReference Include =" DbUp.Tests.Common" Version =" 6.0.0-beta.146" />
14
15
<PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.10.0" />
15
16
<PackageReference Include =" xunit" Version =" 2.9.0" />
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public InMemorySqliteDatabase()
23
23
{
24
24
DataSource = ":memory:" ,
25
25
DefaultTimeout = 5 ,
26
+ Mode = SqliteOpenMode . Memory
26
27
} ;
27
28
ConnectionString = connectionStringBuilder . ToString ( ) ;
28
29
Original file line number Diff line number Diff line change 24
24
25
25
<ItemGroup >
26
26
<PackageReference Include =" dbup-core" Version =" 6.0.0-beta.146" />
27
- <PackageReference Include =" Microsoft.Data.Sqlite" Version =" 8.0.7" />
27
+ <PackageReference Include =" Microsoft.Data.Sqlite.Core " Version =" 8.0.7" />
28
28
</ItemGroup >
29
29
30
30
<ItemGroup >
You can’t perform that action at this time.
0 commit comments