Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and build to the latest #8

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,4 @@
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(TF_BUILD)' == 'true' Or '$(CI)' == 'true'">

<!-- Perform a deterministic build, so our binaries aren't impacted by build server environmental factors (e.g. file paths). -->
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>

<!-- Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>

<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
<DebugType>embedded</DebugType>

</PropertyGroup>

</Project>
4 changes: 3 additions & 1 deletion src/Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ static void Display(string dbType, DbUp.Engine.DatabaseUpgradeResult result, Tim
"{0} Database Upgrade Runtime: {1}",
dbType,
string.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10));
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(result.Error);
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
Console.WriteLine("Failed!");
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/Sample/Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net8</TargetFramework>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
DB Operation: Open connection
Info: Beginning database upgrade
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: SELECT count(name) FROM sqlite_master WHERE type = 'table' AND name = 'SchemaVersions'
DB Operation: Dispose command
Info: Journal table does not exist
Info: Executing Database Server script 'Script0001.sql'
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: SELECT count(name) FROM sqlite_master WHERE type = 'table' AND name = 'SchemaVersions'
DB Operation: Dispose command
Info: Creating the [SchemaVersions] table
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
DB Operation: Open connection
Info: Beginning database upgrade
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: SELECT count(name) FROM sqlite_master WHERE type = 'table' AND name = 'TestSchemaVersions'
DB Operation: Dispose command
Info: Journal table does not exist
Info: Executing Database Server script 'Script0001.sql'
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: SELECT count(name) FROM sqlite_master WHERE type = 'table' AND name = 'TestSchemaVersions'
DB Operation: Dispose command
Info: Creating the [TestSchemaVersions] table
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
DB Operation: Open connection
Info: Beginning database upgrade
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: SELECT count(name) FROM sqlite_master WHERE type = 'table' AND name = 'SchemaVersions'
DB Operation: Dispose command
Info: Journal table does not exist
Info: Executing Database Server script 'Script0001.sql'
Info: Checking whether journal table exists..
Info: Checking whether journal table exists
DB Operation: Execute scalar command: SELECT count(name) FROM sqlite_master WHERE type = 'table' AND name = 'SchemaVersions'
DB Operation: Dispose command
Info: Creating the [SchemaVersions] table
Expand Down
77 changes: 0 additions & 77 deletions src/Tests/ApprovalFiles/NoPublicApiChanges.Run.DotNet.verified.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public class TemporarySQLiteDatabase : System.IDisposable
public TemporarySQLiteDatabase(string name) { }
public DbUp.SQLite.Helpers.SharedConnection SharedConnection { get; }
public DbUp.Helpers.AdHocSqlRunner SqlRunner { get; }
public void Create() { }
public void Dispose() { }
}
}
19 changes: 8 additions & 11 deletions src/Tests/SQLiteSupportTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#if !NETCORE
using System;
using System.Data.SQLite;
using System.IO;
using Microsoft.Data.Sqlite;
using Shouldly;
using Xunit;

namespace DbUp.SQLite.Tests
Expand All @@ -13,18 +11,17 @@ public class SQLiteSupportTests
[Fact]
public void CanUseSQLite()
{
var connectionString = string.Format("Data Source={0}; Version=3;", dbFilePath);

if (!File.Exists(dbFilePath))
{
SQLiteConnection.CreateFile(dbFilePath);
}
var connectionString = $"Data Source={dbFilePath}";

var upgrader = DeployChanges.To
.SQLiteDatabase(connectionString)
.WithScript("Script0001", "CREATE TABLE IF NOT EXISTS Foo (Id int)")
.Build();

var result = upgrader.PerformUpgrade();

result.Error.ShouldBe(null);
result.Successful.ShouldBe(true);
}
}
}
#endif
9 changes: 3 additions & 6 deletions src/Tests/SQLiteTableJournalTests.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#if !NETCORE
using System.Collections.Generic;
using System.Data;
using System.Data.SQLite;
using System.Data;
using DbUp.Engine;
using DbUp.Engine.Output;
using DbUp.Engine.Transactions;
using DbUp.Tests.Common;
using Microsoft.Data.Sqlite;
using NSubstitute;
using Shouldly;
using Xunit;
Expand All @@ -22,7 +20,7 @@ public void dbversion_is_zero_when_journal_table_not_exist()
var command = Substitute.For<IDbCommand>();
dbConnection.CreateCommand().Returns(command);
var connectionManager = Substitute.For<IConnectionManager>();
command.ExecuteScalar().Returns(x => { throw new SQLiteException("table not found"); });
command.ExecuteScalar().Returns(x => { throw new SqliteException("table not found", 0); });
var consoleUpgradeLog = new ConsoleUpgradeLog();
var journal = new SQLiteTableJournal(() => connectionManager, () => consoleUpgradeLog, "SchemaVersions");

Expand Down Expand Up @@ -62,4 +60,3 @@ public void creates_a_new_journal_table_when_not_exist()
}
}
}
#endif
16 changes: 6 additions & 10 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;net8</TargetFrameworks>
<TargetFramework>net8</TargetFramework>
<AssemblyName>Tests</AssemblyName>
<RootNamespace>DbUp.SQLite.Tests</RootNamespace>
<!-- <ImplicitUsings>enable</ImplicitUsings> Can't use implict usings with net46 -->
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net8'">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\dbup-sqlite\dbup-sqlite.csproj"/>
<PackageReference Include="DbUp.Tests.Common" Version="5.0.52-Split.8"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageReference Include="xunit" Version="2.6.6"/>
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<PackageReference Include="DbUp.Tests.Common" Version="6.0.0-beta.108"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
3 changes: 3 additions & 0 deletions src/dbup-sqlite.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQ/@EntryIndexedValue">SQ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String>
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String></wpf:ResourceDictionary>
26 changes: 4 additions & 22 deletions src/dbup-sqlite/Helpers/InMemorySQLiteDatabase.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
using System;
using DbUp.Engine.Transactions;
using DbUp.Helpers;
using Microsoft.Data.Sqlite;

#if MONO
using SQLiteConnection = Mono.Data.Sqlite.SqliteConnection;
using SQLiteConnectionStringBuilder = Mono.Data.Sqlite.SqliteConnectionStringBuilder;
using SQLiteJournalModeEnum = Mono.Data.Sqlite.SQLiteJournalModeEnum;
#elif NETCORE
using SQLiteConnection = Microsoft.Data.Sqlite.SqliteConnection;
using SQLiteConnectionStringBuilder = Microsoft.Data.Sqlite.SqliteConnectionStringBuilder;
#else
using System.Data.SQLite;
#endif

namespace DbUp.SQLite.Helpers
{
Expand All @@ -21,31 +12,22 @@ namespace DbUp.SQLite.Helpers
public class InMemorySQLiteDatabase : IDisposable
{
readonly SQLiteConnectionManager connectionManager;
readonly SQLiteConnection sharedConnection;
readonly SqliteConnection sharedConnection;

/// <summary>
/// Initializes a new instance of the <see cref="InMemorySQLiteDatabase"/> class.
/// </summary>
public InMemorySQLiteDatabase()
{
var connectionStringBuilder = new SQLiteConnectionStringBuilder
var connectionStringBuilder = new SqliteConnectionStringBuilder
{
DataSource = ":memory:",
#if !NETCORE
Version = 3,
DefaultTimeout = 5,
#if MONO
JournalMode = SQLiteJournalModeEnum.Off,
#else
JournalMode = SQLiteJournalModeEnum.Memory,
#endif
UseUTF16Encoding = true
#endif
};
ConnectionString = connectionStringBuilder.ToString();

connectionManager = new SQLiteConnectionManager(connectionStringBuilder.ConnectionString);
sharedConnection = new SQLiteConnection(connectionStringBuilder.ConnectionString);
sharedConnection = new SqliteConnection(connectionStringBuilder.ConnectionString);
sharedConnection.Open();
SqlRunner = new AdHocSqlRunner(() => sharedConnection.CreateCommand(), new SQLiteObjectParser(), null, () => true);
}
Expand Down
Loading
Loading