Skip to content

Commit 4c41acd

Browse files
authored
Merge pull request #1 from DbUp/customise-template
Customise the template for ClickHouse
2 parents 8a0cda8 + 63f7986 commit 4c41acd

12 files changed

+86
-51
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: CI
22

33
on:
4-
#push:
5-
#pull_request:
4+
push:
5+
pull_request:
66
workflow_dispatch:
77

88
jobs:

README.md

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,15 @@
1-
# Using this Template
1+
[![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)
2+
[![NuGet](https://img.shields.io/nuget/dt/dbup-clickhouse.svg)](https://www.nuget.org/packages/dbup-clickhouse)
3+
[![NuGet](https://img.shields.io/nuget/v/dbup-clickhouse.svg)](https://www.nuget.org/packages/dbup-clickhouse)
4+
[![Prerelease](https://img.shields.io/nuget/vpre/dbup-clickhouse?color=orange&label=prerelease)](https://www.nuget.org/packages/dbup-clickhouse)
25

3-
1. Create a new Repository in GitHub based on this template
4-
- The name should be in the form `dbup-nameofthenewprovider`
5-
- It should be public
6-
1. Create PR to add the name of the repo to the `AllProviders.txt` file in the `DbUp` repository
7-
1. Clone it
8-
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)
9-
1. Rename the following:
10-
- `dbup-newprovider.sln`
11-
- `dbup-newprovider.sln.DotSettings`
12-
- `dbup-newprovider\dbup-newprovider.csproj`
13-
- `dbup-newprovider` directory
14-
1. Search for `NewProvider` and replace with the new provider's name, **turning on the preserve case option**
15-
1. Run `dotnet build` to ensure it builds
16-
1. Uncomment the `push` and `pull_request` lines in `.github\workflows\main.yml`
17-
1. Delete these instructions up to and including the next line, then check in
18-
19-
[![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)
20-
[![NuGet](https://img.shields.io/nuget/dt/dbup-newprovider.svg)](https://www.nuget.org/packages/dbup-newprovider)
21-
[![NuGet](https://img.shields.io/nuget/v/dbup-newprovider.svg)](https://www.nuget.org/packages/dbup-newprovider)
22-
[![Prerelease](https://img.shields.io/nuget/vpre/dbup-newprovider?color=orange&label=prerelease)](https://www.nuget.org/packages/dbup-newprovider)
23-
24-
# DbUp NewProvider support
6+
# DbUp ClickHouse support
257
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.
268

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

30-
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).
12+
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).
3113

3214
# Contributing
3315

src/Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
<PropertyGroup>
55
<Authors>https://github.com/orgs/DbUp/people</Authors>
6-
<PackageReleaseNotes>https://github.com/DbUp/dbup-newprovider/releases</PackageReleaseNotes>
6+
<PackageReleaseNotes>https://github.com/DbUp/dbup-clickhouse/releases</PackageReleaseNotes>
77
<PackageProjectUrl>https://dbup.github.io</PackageProjectUrl>
88
<PackageLicenseExpression>MIT</PackageLicenseExpression>
9-
<RepositoryUrl>https://github.com/dbup-newprovider/dbup-newprovider.git</RepositoryUrl>
9+
<RepositoryUrl>https://github.com/dbup-clickhouse/dbup-clickhouse.git</RepositoryUrl>
1010
<LangVersion>latest</LangVersion>
1111
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1212
</PropertyGroup>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
namespace DbUp.ClickHouse
3+
{
4+
public static class ClickHouseExtensions
5+
{
6+
public static DbUp.Builder.UpgradeEngineBuilder ClickHouseDatabase(this DbUp.Builder.SupportedDatabases supportedDatabases, string connectionString) { }
7+
}
8+
public class ClickHouseJournal : DbUp.Engine.IJournal
9+
{
10+
public ClickHouseJournal(System.Func<DbUp.Engine.Transactions.IConnectionManager> connectionManagerFactory, System.Func<DbUp.Engine.Output.IUpgradeLog> logFactory, string tableName) { }
11+
public void EnsureTableExistsAndIsLatestVersion(System.Func<System.Data.IDbCommand> dbCommandFactory) { }
12+
public string[] GetExecutedScripts() { }
13+
public void StoreExecutedScript(DbUp.Engine.SqlScript script, System.Func<System.Data.IDbCommand> dbCommandFactory) { }
14+
}
15+
}

src/Tests/DatabaseSupportTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using DbUp.Builder;
22
using DbUp.Tests.Common;
33

4-
namespace DbUp.NewProvider.Tests;
4+
namespace DbUp.ClickHouse.Tests;
55

66
public class DatabaseSupportTests : DatabaseSupportTestsBase
77
{
@@ -10,11 +10,11 @@ public DatabaseSupportTests() : base()
1010
}
1111

1212
protected override UpgradeEngineBuilder DeployTo(SupportedDatabases to)
13-
=> to.NewProviderDatabase("");
13+
=> to.ClickHouseDatabase("");
1414

1515
protected override UpgradeEngineBuilder AddCustomNamedJournalToBuilder(UpgradeEngineBuilder builder, string schema, string tableName)
1616
=> builder.JournalTo(
1717
(connectionManagerFactory, logFactory)
18-
=> new NewProviderJournal(connectionManagerFactory, logFactory, tableName)
18+
=> new ClickHouseJournal(connectionManagerFactory, logFactory, tableName)
1919
);
2020
}

src/Tests/NoPublicApiChanges.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
using DbUp.Tests.Common;
22

3-
namespace DbUp.NewProvider.Tests;
3+
namespace DbUp.ClickHouse.Tests;
44

55
public class NoPublicApiChanges : NoPublicApiChangesBase
66
{
77
public NoPublicApiChanges()
8-
: base(typeof(NewProviderExtensions).Assembly)
8+
: base(typeof(ClickHouseExtensions).Assembly)
99
{
1010
}
1111
}

src/Tests/Tests.csproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net462;net8</TargetFrameworks>
4+
<TargetFramework>net8</TargetFramework>
55
<AssemblyName>Tests</AssemblyName>
6-
<RootNamespace>DbUp.NewProvider.Tests</RootNamespace>
7-
<!-- <ImplicitUsings>enable</ImplicitUsings> Can't use implict usings with net46 -->
6+
<RootNamespace>DbUp.ClickHouse.Tests</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<ProjectReference Include="..\dbup-newprovider\dbup-newprovider.csproj"/>
13-
<PackageReference Include="DbUp.Tests.Common" Version="5.0.37"/>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
15-
<PackageReference Include="xunit" Version="2.6.6"/>
16-
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
12+
<ProjectReference Include="..\dbup-clickhouse\dbup-clickhouse.csproj"/>
13+
<PackageReference Include="DbUp.Tests.Common" Version="6.0.5" />
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
15+
<PackageReference Include="xunit" Version="2.9.3" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
</PackageReference>

src/dbup-newprovider.sln renamed to src/dbup-clickhouse.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbup-newprovider", "dbup-newprovider\dbup-newprovider.csproj", "{2A7189BD-96CE-41CA-9100-E1B1DD10FF40}"
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbup-clickhouse", "dbup-clickhouse\dbup-clickhouse.csproj", "{2A7189BD-96CE-41CA-9100-E1B1DD10FF40}"
44
EndProject
55
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{8CE634FE-6772-408E-9340-909F6218F8F7}"
66
EndProject
@@ -22,7 +22,7 @@ EndProject
2222
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{77157734-01DA-4AA3-A15C-504013343B29}"
2323
ProjectSection(SolutionItems) = preProject
2424
.editorconfig = .editorconfig
25-
dbup-newprovider.sln.DotSettings = dbup-newprovider.sln.DotSettings
25+
dbup-clickhouse.sln.DotSettings = dbup-clickhouse.sln.DotSettings
2626
Directory.Build.props = Directory.Build.props
2727
EndProjectSection
2828
EndProject

src/dbup-newprovider.sln.DotSettings renamed to src/dbup-clickhouse.sln.DotSettings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@
55
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SQ/@EntryIndexedValue">SQ</s:String>
66
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
77
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
8+
<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>
9+
<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>
10+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
811
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue">&lt;data&gt;&lt;IncludeFilters /&gt;&lt;ExcludeFilters /&gt;&lt;/data&gt;</s:String>
912
<s:String x:Key="/Default/FilterSettingsManager/AttributeFilterXml/@EntryValue">&lt;data /&gt;</s:String></wpf:ResourceDictionary>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System;
2+
using DbUp.Builder;
3+
4+
namespace DbUp.ClickHouse;
5+
6+
public static class ClickHouseExtensions
7+
{
8+
public static UpgradeEngineBuilder ClickHouseDatabase(this SupportedDatabases supportedDatabases, string connectionString)
9+
{
10+
throw new NotImplementedException();
11+
}
12+
}

0 commit comments

Comments
 (0)