File tree Expand file tree Collapse file tree 6 files changed +32
-6
lines changed Expand file tree Collapse file tree 6 files changed +32
-6
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using Microsoft . Data . Sqlite ;
23
34namespace SqliteSampleApplication
45{
@@ -55,7 +56,7 @@ static void TemporaryFileDb()
5556
5657 static void PermanentFileDb ( )
5758 {
58- Microsoft . Data . Sqlite . SqliteConnection connection = new ( "Data Source=dbup.db" ) ;
59+ SqliteConnection connection = new ( "Data Source=dbup.db" ) ;
5960
6061 using ( var database = new DbUp . Sqlite . Helpers . SharedConnection ( connection ) )
6162 {
Original file line number Diff line number Diff line change 77
88 <ItemGroup >
99 <ProjectReference Include =" ..\dbup-sqlite\dbup-sqlite.csproj" />
10+ <PackageReference Include =" Microsoft.Data.Sqlite" Version =" 8.0.7" />
1011 </ItemGroup >
1112
1213 <ItemGroup >
Original file line number Diff line number Diff line change 1- using Microsoft . Data . Sqlite ;
2- using Shouldly ;
1+ using Shouldly ;
32using Xunit ;
43
54namespace DbUp . Sqlite . Tests
65{
76 public class SqliteSupportTests
87 {
9- static readonly string dbFilePath = Path . Combine ( Environment . CurrentDirectory , "test.db" ) ;
8+ static readonly string DbFilePath = Path . Combine ( Environment . CurrentDirectory , "test.db" ) ;
109
1110 [ Fact ]
1211 public void CanUseSQLite ( )
1312 {
14- var connectionString = $ "Data Source={ dbFilePath } ";
13+ var connectionString = $ "Data Source={ DbFilePath } ";
1514
1615 var upgrader = DeployChanges . To
1716 . SqliteDatabase ( connectionString )
@@ -23,5 +22,28 @@ public void CanUseSQLite()
2322 result . Error . ShouldBe ( null ) ;
2423 result . Successful . ShouldBe ( true ) ;
2524 }
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+ }
2648 }
2749}
Original file line number Diff line number Diff line change 1010
1111 <ItemGroup >
1212 <ProjectReference Include =" ..\dbup-sqlite\dbup-sqlite.csproj" />
13+ <PackageReference Include =" Microsoft.Data.Sqlite" Version =" 8.0.7" />
1314 <PackageReference Include =" DbUp.Tests.Common" Version =" 6.0.0-beta.146" />
1415 <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 17.10.0" />
1516 <PackageReference Include =" xunit" Version =" 2.9.0" />
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public InMemorySqliteDatabase()
2323 {
2424 DataSource = ":memory:" ,
2525 DefaultTimeout = 5 ,
26+ Mode = SqliteOpenMode . Memory
2627 } ;
2728 ConnectionString = connectionStringBuilder . ToString ( ) ;
2829
Original file line number Diff line number Diff line change 2424
2525 <ItemGroup >
2626 <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" />
2828 </ItemGroup >
2929
3030 <ItemGroup >
You can’t perform that action at this time.
0 commit comments