Skip to content

Commit

Permalink
Merge branch 'release/6.0.0' into Caps
Browse files Browse the repository at this point in the history
  • Loading branch information
droyad committed Dec 17, 2024
2 parents 26c1c55 + 73dd9a9 commit 279bb3f
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Microsoft.Data.Sqlite;

namespace SqliteSampleApplication
{
Expand Down Expand Up @@ -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))
{
Expand Down
1 change: 1 addition & 0 deletions src/Sample/Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<ItemGroup>
<ProjectReference Include="..\dbup-sqlite\dbup-sqlite.csproj"/>
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.7" />
</ItemGroup>

<ItemGroup>
Expand Down
30 changes: 26 additions & 4 deletions src/Tests/SqliteSupportTests.cs
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -23,5 +22,28 @@ public void CanUseSQLite()
result.Error.ShouldBe(null);
result.Successful.ShouldBe(true);
}

/// <summary>
/// Test for https://github.com/DbUp/dbup-sqlite/issues/2
/// </summary>
[Fact]
public void DoesNotExhibitSafeHandleError()
{
var connectionString = "Data source=:memory:";

var upgrader =
DeployChanges.To
.SQLiteDatabase(connectionString)

Check failure on line 36 in src/Tests/SqliteSupportTests.cs

View workflow job for this annotation

GitHub Actions / Build / build

'SupportedDatabases' does not contain a definition for 'SQLiteDatabase' and no accessible extension method 'SQLiteDatabase' accepting a first argument of type 'SupportedDatabases' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 36 in src/Tests/SqliteSupportTests.cs

View workflow job for this annotation

GitHub Actions / Build / build

'SupportedDatabases' does not contain a definition for 'SQLiteDatabase' and no accessible extension method 'SQLiteDatabase' accepting a first argument of type 'SupportedDatabases' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 36 in src/Tests/SqliteSupportTests.cs

View workflow job for this annotation

GitHub Actions / Build / build

'SupportedDatabases' does not contain a definition for 'SQLiteDatabase' and no accessible extension method 'SQLiteDatabase' accepting a first argument of type 'SupportedDatabases' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 36 in src/Tests/SqliteSupportTests.cs

View workflow job for this annotation

GitHub Actions / Build / build

'SupportedDatabases' does not contain a definition for 'SQLiteDatabase' and no accessible extension method 'SQLiteDatabase' accepting a first argument of type 'SupportedDatabases' could be found (are you missing a using directive or an assembly reference?)
.WithScript("Script001", @"
create table test (
contact_id INTEGER PRIMARY KEY
);
")
.LogScriptOutput()
.LogToConsole()
.Build();
var result = upgrader.PerformUpgrade();
result.Successful.ShouldBeTrue();
}
}
}
1 change: 1 addition & 0 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<ProjectReference Include="..\dbup-sqlite\dbup-sqlite.csproj"/>
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.7" />
<PackageReference Include="DbUp.Tests.Common" Version="6.0.0-beta.146"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="xunit" Version="2.9.0" />
Expand Down
1 change: 1 addition & 0 deletions src/dbup-sqlite/Helpers/InMemorySqliteDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public InMemorySqliteDatabase()
{
DataSource = ":memory:",
DefaultTimeout = 5,
Mode = SqliteOpenMode.Memory
};
ConnectionString = connectionStringBuilder.ToString();

Expand Down
2 changes: 1 addition & 1 deletion src/dbup-sqlite/dbup-sqlite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<ItemGroup>
<PackageReference Include="dbup-core" Version="6.0.0-beta.146"/>
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.7" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.7" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 279bb3f

Please sign in to comment.