Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: CI

on:
#push:
#pull_request:
push:
pull_request:
workflow_dispatch:

jobs:
Expand Down
30 changes: 6 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,15 @@
# Using this Template
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/DbUp/dbup-clickhouse/main.yml?branch=main)](https://github.com/DbUp/dbup-clickhouse/actions/workflows/main.yml?query=branch%3Amain)
[![NuGet](https://img.shields.io/nuget/dt/dbup-clickhouse.svg)](https://www.nuget.org/packages/dbup-clickhouse)
[![NuGet](https://img.shields.io/nuget/v/dbup-clickhouse.svg)](https://www.nuget.org/packages/dbup-clickhouse)
[![Prerelease](https://img.shields.io/nuget/vpre/dbup-clickhouse?color=orange&label=prerelease)](https://www.nuget.org/packages/dbup-clickhouse)

1. Create a new Repository in GitHub based on this template
- The name should be in the form `dbup-nameofthenewprovider`
- It should be public
1. Create PR to add the name of the repo to the `AllProviders.txt` file in the `DbUp` repository
1. Clone it
1. Open it in VSCode or other light weight editor that doesn't have strong opinions about solution/project structure (i.e. not Rider/VS)
1. Rename the following:
- `dbup-newprovider.sln`
- `dbup-newprovider.sln.DotSettings`
- `dbup-newprovider\dbup-newprovider.csproj`
- `dbup-newprovider` directory
1. Search for `NewProvider` and replace with the new provider's name, **turning on the preserve case option**
1. Run `dotnet build` to ensure it builds
1. Uncomment the `push` and `pull_request` lines in `.github\workflows\main.yml`
1. Delete these instructions up to and including the next line, then check in

[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/DbUp/dbup-newprovider/main.yml?branch=main)](https://github.com/DbUp/dbup-newprovider/actions/workflows/main.yml?query=branch%3Amain)
[![NuGet](https://img.shields.io/nuget/dt/dbup-newprovider.svg)](https://www.nuget.org/packages/dbup-newprovider)
[![NuGet](https://img.shields.io/nuget/v/dbup-newprovider.svg)](https://www.nuget.org/packages/dbup-newprovider)
[![Prerelease](https://img.shields.io/nuget/vpre/dbup-newprovider?color=orange&label=prerelease)](https://www.nuget.org/packages/dbup-newprovider)

# DbUp NewProvider support
# DbUp ClickHouse support
DbUp is a .NET library that helps you to deploy changes to SQL Server databases. It tracks which SQL scripts have been run already, and runs the change scripts that are needed to get your database up to date.

## Getting Help
To learn more about DbUp check out the [documentation](https://dbup.readthedocs.io/en/latest/)

Please only log issue related to NewProvider support in this repo. For cross cutting issues, please use our [main issue list](https://github.com/DbUp/DbUp/issues).
Please only log issue related to ClickHouse support in this repo. For cross cutting issues, please use our [main issue list](https://github.com/DbUp/DbUp/issues).

# Contributing

Expand Down
4 changes: 2 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

<PropertyGroup>
<Authors>https://github.com/orgs/DbUp/people</Authors>
<PackageReleaseNotes>https://github.com/DbUp/dbup-newprovider/releases</PackageReleaseNotes>
<PackageReleaseNotes>https://github.com/DbUp/dbup-clickhouse/releases</PackageReleaseNotes>
<PackageProjectUrl>https://dbup.github.io</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/dbup-newprovider/dbup-newprovider.git</RepositoryUrl>
<RepositoryUrl>https://github.com/dbup-clickhouse/dbup-clickhouse.git</RepositoryUrl>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/Tests/ApprovalFiles/NoPublicApiChanges.Run.approved.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

namespace DbUp.ClickHouse
{
public static class ClickHouseExtensions
{
public static DbUp.Builder.UpgradeEngineBuilder ClickHouseDatabase(this DbUp.Builder.SupportedDatabases supportedDatabases, string connectionString) { }
}
public class ClickHouseJournal : DbUp.Engine.IJournal
{
public ClickHouseJournal(System.Func<DbUp.Engine.Transactions.IConnectionManager> connectionManagerFactory, System.Func<DbUp.Engine.Output.IUpgradeLog> logFactory, string tableName) { }
public void EnsureTableExistsAndIsLatestVersion(System.Func<System.Data.IDbCommand> dbCommandFactory) { }
public string[] GetExecutedScripts() { }
public void StoreExecutedScript(DbUp.Engine.SqlScript script, System.Func<System.Data.IDbCommand> dbCommandFactory) { }
}
}
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.NewProvider.Tests;
namespace DbUp.ClickHouse.Tests;

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

protected override UpgradeEngineBuilder DeployTo(SupportedDatabases to)
=> to.NewProviderDatabase("");
=> to.ClickHouseDatabase("");

protected override UpgradeEngineBuilder AddCustomNamedJournalToBuilder(UpgradeEngineBuilder builder, string schema, string tableName)
=> builder.JournalTo(
(connectionManagerFactory, logFactory)
=> new NewProviderJournal(connectionManagerFactory, logFactory, tableName)
=> new ClickHouseJournal(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.NewProvider.Tests;
namespace DbUp.ClickHouse.Tests;

public class NoPublicApiChanges : NoPublicApiChangesBase
{
public NoPublicApiChanges()
: base(typeof(NewProviderExtensions).Assembly)
: base(typeof(ClickHouseExtensions).Assembly)
{
}
}
16 changes: 8 additions & 8 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<ItemGroup>
<ProjectReference Include="..\dbup-newprovider\dbup-newprovider.csproj"/>
<PackageReference Include="DbUp.Tests.Common" Version="5.0.37"/>
<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">
<ProjectReference Include="..\dbup-clickhouse\dbup-clickhouse.csproj"/>
<PackageReference Include="DbUp.Tests.Common" Version="6.0.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/dbup-newprovider.sln → src/dbup-clickhouse.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbup-newprovider", "dbup-newprovider\dbup-newprovider.csproj", "{2A7189BD-96CE-41CA-9100-E1B1DD10FF40}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbup-clickhouse", "dbup-clickhouse\dbup-clickhouse.csproj", "{2A7189BD-96CE-41CA-9100-E1B1DD10FF40}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{8CE634FE-6772-408E-9340-909F6218F8F7}"
EndProject
Expand All @@ -22,7 +22,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{77157734-01DA-4AA3-A15C-504013343B29}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
dbup-newprovider.sln.DotSettings = dbup-newprovider.sln.DotSettings
dbup-clickhouse.sln.DotSettings = dbup-clickhouse.sln.DotSettings
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Expand Down
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" WarnAboutPrefixesAndSuffixes="False" 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" WarnAboutPrefixesAndSuffixes="False" 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>
12 changes: 12 additions & 0 deletions src/dbup-clickhouse/ClickHouseExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System;
using DbUp.Builder;

namespace DbUp.ClickHouse;

public static class ClickHouseExtensions
{
public static UpgradeEngineBuilder ClickHouseDatabase(this SupportedDatabases supportedDatabases, string connectionString)
{
throw new NotImplementedException();
}
}
23 changes: 23 additions & 0 deletions src/dbup-clickhouse/ClickHouseJournal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Data;
using DbUp.Engine;
using DbUp.Engine.Output;
using DbUp.Engine.Transactions;

namespace DbUp.ClickHouse;

public class ClickHouseJournal(
// Remove pragma once implemented
#pragma warning disable CS9113 // Parameter is unread.
Func<IConnectionManager> connectionManagerFactory,
Func<IUpgradeLog> logFactory,
string tableName
#pragma warning restore CS9113 // Parameter is unread.
) : IJournal
{
public string[] GetExecutedScripts() => throw new NotImplementedException();

public void StoreExecutedScript(SqlScript script, Func<IDbCommand> dbCommandFactory) => throw new NotImplementedException();

public void EnsureTableExistsAndIsLatestVersion(Func<IDbCommand> dbCommandFactory) => throw new NotImplementedException();
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>DbUp makes it easy to deploy and upgrade SQL Server databases. This package adds NewProvider support.</Description>
<Title>DbUp NewProvider Support</Title>
<Description>DbUp makes it easy to deploy and upgrade SQL Server databases. This package adds ClickHouse support.</Description>
<Title>DbUp ClickHouse Support</Title>
<Company>DbUp Contributors</Company>
<Product>DbUp</Product>
<Copyright>Copyright © DbUp Contributors 2015</Copyright>
<TargetFrameworks>netstandard1.3;netstandard2.0;net35;net45</TargetFrameworks>
<AssemblyName>dbup-newprovider</AssemblyName>
<RootNamespace>DbUp.NewProvider</RootNamespace>
<PackageId>dbup-newprovider</PackageId>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>dbup-clickhouse</AssemblyName>
<RootNamespace>DbUp.ClickHouse</RootNamespace>
<PackageId>dbup-clickhouse</PackageId>
<AssemblyOriginatorKeyFile>../dbup.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<RepositoryUrl>https://github.com/DbUp/dbup-newprovider.git</RepositoryUrl>
<RepositoryUrl>https://github.com/DbUp/dbup-clickhouse.git</RepositoryUrl>
<PackageIcon>dbup-icon.png</PackageIcon>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="dbup-core" Version="5.0.37"/>
<PackageReference Include="dbup-core" Version="6.0.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading