Skip to content

Commit

Permalink
Changed case from SQLite to Sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
droyad committed Jul 29, 2024
1 parent 3077cb2 commit 26c1c55
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 91 deletions.
14 changes: 7 additions & 7 deletions src/Sample/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace SQLiteSampleApplication
namespace SqliteSampleApplication
{
public static class Program
{
Expand All @@ -13,11 +13,11 @@ static void Main()

static void InMemoryDb()
{
using (var database = new DbUp.SQLite.Helpers.InMemorySQLiteDatabase())
using (var database = new DbUp.Sqlite.Helpers.InMemorySqliteDatabase())
{
var upgrader =
DbUp.DeployChanges.To
.SQLiteDatabase(database.ConnectionString)
.SqliteDatabase(database.ConnectionString)
.WithScriptsEmbeddedInAssembly(System.Reflection.Assembly.GetExecutingAssembly())
.LogToConsole()
.Build();
Expand All @@ -34,11 +34,11 @@ static void InMemoryDb()

static void TemporaryFileDb()
{
using (var database = new DbUp.SQLite.Helpers.TemporarySQLiteDatabase("test.db"))
using (var database = new DbUp.Sqlite.Helpers.TemporarySqliteDatabase("test.db"))
{
var upgrader =
DbUp.DeployChanges.To
.SQLiteDatabase(database.SharedConnection)
.SqliteDatabase(database.SharedConnection)
.WithScriptsEmbeddedInAssembly(System.Reflection.Assembly.GetExecutingAssembly())
.LogToConsole()
.Build();
Expand All @@ -57,11 +57,11 @@ static void PermanentFileDb()
{
Microsoft.Data.Sqlite.SqliteConnection connection = new("Data Source=dbup.db");

using (var database = new DbUp.SQLite.Helpers.SharedConnection(connection))
using (var database = new DbUp.Sqlite.Helpers.SharedConnection(connection))
{
var upgrader = DbUp.DeployChanges
.To
.SQLiteDatabase(connection.ConnectionString)
.SqliteDatabase(connection.ConnectionString)
.WithScriptsEmbeddedInAssembly(System.Reflection.Assembly.GetExecutingAssembly())
.LogToConsole()
.Build();
Expand Down
44 changes: 22 additions & 22 deletions src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,49 @@
[assembly: System.Runtime.InteropServices.ComVisibleAttribute(false)]
[assembly: System.Runtime.InteropServices.GuidAttribute("9f949414-f078-49bf-b50e-a3859c18fb6e")]

public static class SQLiteExtensions
public static class SqliteExtensions
{
public static DbUp.Builder.UpgradeEngineBuilder JournalToSQLiteTable(this DbUp.Builder.UpgradeEngineBuilder builder, string table) { }
public static DbUp.Builder.UpgradeEngineBuilder SQLiteDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
public static DbUp.Builder.UpgradeEngineBuilder SQLiteDatabase(this DbUp.Builder.SupportedDatabases supported, DbUp.SQLite.Helpers.SharedConnection sharedConnection) { }
public static DbUp.Builder.UpgradeEngineBuilder JournalToSqliteTable(this DbUp.Builder.UpgradeEngineBuilder builder, string table) { }
public static DbUp.Builder.UpgradeEngineBuilder SqliteDatabase(this DbUp.Builder.SupportedDatabases supported, string connectionString) { }
public static DbUp.Builder.UpgradeEngineBuilder SqliteDatabase(this DbUp.Builder.SupportedDatabases supported, DbUp.Sqlite.Helpers.SharedConnection sharedConnection) { }
}
namespace DbUp.SQLite
namespace DbUp.Sqlite
{
public class SQLiteConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager, DbUp.Engine.Transactions.IConnectionManager
public class SqliteConnectionManager : DbUp.Engine.Transactions.DatabaseConnectionManager, DbUp.Engine.Transactions.IConnectionManager
{
public SQLiteConnectionManager(string connectionString) { }
public SQLiteConnectionManager(DbUp.SQLite.Helpers.SharedConnection sharedConnection) { }
public SqliteConnectionManager(string connectionString) { }
public SqliteConnectionManager(DbUp.Sqlite.Helpers.SharedConnection sharedConnection) { }
public override System.Collections.Generic.IEnumerable<string> SplitScriptIntoCommands(string scriptContents) { }
}
public class SQLiteObjectParser : DbUp.Support.SqlObjectParser, DbUp.Engine.ISqlObjectParser
public class SqliteObjectParser : DbUp.Support.SqlObjectParser, DbUp.Engine.ISqlObjectParser
{
public SQLiteObjectParser() { }
public SqliteObjectParser() { }
}
public class SQLitePreprocessor : DbUp.Engine.IScriptPreprocessor
public class SqlitePreprocessor : DbUp.Engine.IScriptPreprocessor
{
public SQLitePreprocessor() { }
public SqlitePreprocessor() { }
public string Process(string contents) { }
}
public class SQLiteScriptExecutor : DbUp.Support.ScriptExecutor, DbUp.Engine.IScriptExecutor
public class SqliteScriptExecutor : DbUp.Support.ScriptExecutor, DbUp.Engine.IScriptExecutor
{
public SQLiteScriptExecutor(System.Func<DbUp.Engine.Transactions.IConnectionManager> connectionManagerFactory, System.Func<DbUp.Engine.Output.IUpgradeLog> log, string schema, System.Func<bool> variablesEnabled, System.Collections.Generic.IEnumerable<DbUp.Engine.IScriptPreprocessor> scriptPreprocessors, System.Func<DbUp.Engine.IJournal> journalFactory) { }
public SqliteScriptExecutor(System.Func<DbUp.Engine.Transactions.IConnectionManager> connectionManagerFactory, System.Func<DbUp.Engine.Output.IUpgradeLog> log, string schema, System.Func<bool> variablesEnabled, System.Collections.Generic.IEnumerable<DbUp.Engine.IScriptPreprocessor> scriptPreprocessors, System.Func<DbUp.Engine.IJournal> journalFactory) { }
protected override void ExecuteCommandsWithinExceptionHandler(int index, DbUp.Engine.SqlScript script, System.Action executeCommand) { }
protected override string GetVerifySchemaSql(string schema) { }
}
public class SQLiteTableJournal : DbUp.Support.TableJournal, DbUp.Engine.IJournal
public class SqliteTableJournal : DbUp.Support.TableJournal, DbUp.Engine.IJournal
{
public SQLiteTableJournal(System.Func<DbUp.Engine.Transactions.IConnectionManager> connectionManager, System.Func<DbUp.Engine.Output.IUpgradeLog> logger, string table) { }
public SqliteTableJournal(System.Func<DbUp.Engine.Transactions.IConnectionManager> connectionManager, System.Func<DbUp.Engine.Output.IUpgradeLog> logger, string table) { }
protected override string CreateSchemaTableSql(string quotedPrimaryKeyName) { }
protected override string DoesTableExistSql() { }
protected override string GetInsertJournalEntrySql(string scriptName, string applied) { }
protected override string GetJournalEntriesSql() { }
}
}
namespace DbUp.SQLite.Helpers
namespace DbUp.Sqlite.Helpers
{
public class InMemorySQLiteDatabase : System.IDisposable
public class InMemorySqliteDatabase : System.IDisposable
{
public InMemorySQLiteDatabase() { }
public InMemorySqliteDatabase() { }
public string ConnectionString { get; set; }
public DbUp.Helpers.AdHocSqlRunner SqlRunner { get; }
public void Dispose() { }
Expand All @@ -66,10 +66,10 @@ public void Dispose() { }
public void DoClose() { }
public void Open() { }
}
public class TemporarySQLiteDatabase : System.IDisposable
public class TemporarySqliteDatabase : System.IDisposable
{
public TemporarySQLiteDatabase(string name) { }
public DbUp.SQLite.Helpers.SharedConnection SharedConnection { get; }
public TemporarySqliteDatabase(string name) { }
public DbUp.Sqlite.Helpers.SharedConnection SharedConnection { get; }
public DbUp.Helpers.AdHocSqlRunner SqlRunner { get; }
public void Dispose() { }
}
Expand Down
6 changes: 3 additions & 3 deletions src/Tests/DatabaseSupportTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using DbUp.Builder;
using DbUp.Tests.Common;

namespace DbUp.SQLite.Tests;
namespace DbUp.Sqlite.Tests;

public class DatabaseSupportTests : DatabaseSupportTestsBase
{
Expand All @@ -10,11 +10,11 @@ public DatabaseSupportTests() : base()
}

protected override UpgradeEngineBuilder DeployTo(SupportedDatabases to)
=> to.SQLiteDatabase("");
=> to.SqliteDatabase("");

protected override UpgradeEngineBuilder AddCustomNamedJournalToBuilder(UpgradeEngineBuilder builder, string schema, string tableName)
=> builder.JournalTo(
(connectionManagerFactory, logFactory)
=> new SQLiteTableJournal(connectionManagerFactory, logFactory, tableName)
=> new SqliteTableJournal(connectionManagerFactory, logFactory, tableName)
);
}
4 changes: 2 additions & 2 deletions src/Tests/NoPublicApiChanges.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using DbUp.Tests.Common;

namespace DbUp.SQLite.Tests;
namespace DbUp.Sqlite.Tests;

public class NoPublicApiChanges : NoPublicApiChangesBase
{
public NoPublicApiChanges()
: base(typeof(SQLiteExtensions).Assembly)
: base(typeof(SqliteExtensions).Assembly)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
using Shouldly;
using Xunit;

namespace DbUp.SQLite.Tests
namespace DbUp.Sqlite.Tests
{
public class SQLiteSupportTests
public class SqliteSupportTests
{
static readonly string dbFilePath = Path.Combine(Environment.CurrentDirectory, "test.db");

Expand All @@ -14,7 +14,7 @@ public void CanUseSQLite()
var connectionString = $"Data Source={dbFilePath}";

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
using Shouldly;
using Xunit;

namespace DbUp.SQLite.Tests
namespace DbUp.Sqlite.Tests
{
public class SQLiteTableJournalTests
public class SqliteTableJournalTests
{
[Fact]
public void dbversion_is_zero_when_journal_table_not_exist()
Expand All @@ -22,7 +22,7 @@ public void dbversion_is_zero_when_journal_table_not_exist()
var connectionManager = Substitute.For<IConnectionManager>();
command.ExecuteScalar().Returns(x => { throw new SqliteException("table not found", 0); });
var consoleUpgradeLog = new ConsoleUpgradeLog();
var journal = new SQLiteTableJournal(() => connectionManager, () => consoleUpgradeLog, "SchemaVersions");
var journal = new SqliteTableJournal(() => connectionManager, () => consoleUpgradeLog, "SchemaVersions");

// When
var scripts = journal.GetExecutedScripts();
Expand All @@ -47,7 +47,7 @@ public void creates_a_new_journal_table_when_not_exist()
command.CreateParameter().Returns(param1, param2);
command.ExecuteScalar().Returns(x => 0);
var consoleUpgradeLog = new ConsoleUpgradeLog();
var journal = new SQLiteTableJournal(() => connectionManager, () => consoleUpgradeLog, "SchemaVersions");
var journal = new SqliteTableJournal(() => connectionManager, () => consoleUpgradeLog, "SchemaVersions");

// When
journal.StoreExecutedScript(new SqlScript("test", "select 1"), () => command);
Expand Down
2 changes: 1 addition & 1 deletion src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net8</TargetFramework>
<AssemblyName>Tests</AssemblyName>
<RootNamespace>DbUp.SQLite.Tests</RootNamespace>
<RootNamespace>DbUp.Sqlite.Tests</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
using Microsoft.Data.Sqlite;


namespace DbUp.SQLite.Helpers
namespace DbUp.Sqlite.Helpers
{
/// <summary>
/// Used to create in-memory SQLite database that is deleted at the end of a test.
/// </summary>
public class InMemorySQLiteDatabase : IDisposable
public class InMemorySqliteDatabase : IDisposable
{
readonly SQLiteConnectionManager connectionManager;
readonly SqliteConnectionManager connectionManager;
readonly SqliteConnection sharedConnection;

/// <summary>
/// Initializes a new instance of the <see cref="InMemorySQLiteDatabase"/> class.
/// Initializes a new instance of the <see cref="InMemorySqliteDatabase"/> class.
/// </summary>
public InMemorySQLiteDatabase()
public InMemorySqliteDatabase()
{
var connectionStringBuilder = new SqliteConnectionStringBuilder
{
Expand All @@ -26,10 +26,10 @@ public InMemorySQLiteDatabase()
};
ConnectionString = connectionStringBuilder.ToString();

connectionManager = new SQLiteConnectionManager(connectionStringBuilder.ConnectionString);
connectionManager = new SqliteConnectionManager(connectionStringBuilder.ConnectionString);
sharedConnection = new SqliteConnection(connectionStringBuilder.ConnectionString);
sharedConnection.Open();
SqlRunner = new AdHocSqlRunner(() => sharedConnection.CreateCommand(), new SQLiteObjectParser(), null, () => true);
SqlRunner = new AdHocSqlRunner(() => sharedConnection.CreateCommand(), new SqliteObjectParser(), null, () => true);
}

public string ConnectionString { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/dbup-sqlite/Helpers/SharedConnection.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Data;

namespace DbUp.SQLite.Helpers
namespace DbUp.Sqlite.Helpers
{
/// <summary>
/// A database connection wrapper to manage underlying connection as a shared connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
using Microsoft.Data.Sqlite;


namespace DbUp.SQLite.Helpers
namespace DbUp.Sqlite.Helpers
{
/// <summary>
/// Used to create SQLite databases that are deleted at the end of a test.
/// </summary>
public class TemporarySQLiteDatabase : IDisposable
public class TemporarySqliteDatabase : IDisposable
{
readonly string dataSourcePath;
readonly SqliteConnection sqLiteConnection;

/// <summary>
/// Initializes a new instance of the <see cref="TemporarySQLiteDatabase"/> class.
/// Initializes a new instance of the <see cref="TemporarySqliteDatabase"/> class.
/// </summary>
/// <param name="name">The name.</param>
public TemporarySQLiteDatabase(string name)
public TemporarySqliteDatabase(string name)
{
dataSourcePath = Path.Combine(Directory.GetCurrentDirectory(), name);

Expand All @@ -31,7 +31,7 @@ public TemporarySQLiteDatabase(string name)
sqLiteConnection = new SqliteConnection(connectionStringBuilder.ConnectionString);
sqLiteConnection.Open();
SharedConnection = new SharedConnection(sqLiteConnection);
SqlRunner = new AdHocSqlRunner(() => sqLiteConnection.CreateCommand(), new SQLiteObjectParser(), null, () => true);
SqlRunner = new AdHocSqlRunner(() => sqLiteConnection.CreateCommand(), new SqliteObjectParser(), null, () => true);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
using System.Linq;
using System.Text.RegularExpressions;
using DbUp.Engine.Transactions;
using DbUp.SQLite.Helpers;
using DbUp.Sqlite.Helpers;
using Microsoft.Data.Sqlite;

namespace DbUp.SQLite
namespace DbUp.Sqlite
{
/// <summary>
/// Connection manager for Sql Lite
/// </summary>
public class SQLiteConnectionManager : DatabaseConnectionManager
public class SqliteConnectionManager : DatabaseConnectionManager
{
/// <summary>
/// Creates new SQLite Connection Manager
/// </summary>
public SQLiteConnectionManager(string connectionString) : base(l => new SqliteConnection(connectionString))
public SqliteConnectionManager(string connectionString) : base(l => new SqliteConnection(connectionString))
{
}

/// <summary>
/// Creates new SQLite Connection Manager
/// </summary>
public SQLiteConnectionManager(SharedConnection sharedConnection) : base(l => sharedConnection)
public SqliteConnectionManager(SharedConnection sharedConnection) : base(l => sharedConnection)
{
}

Expand Down
Loading

0 comments on commit 26c1c55

Please sign in to comment.