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

clickhouse: honor DefaultMigrationsTableEngine when created WithInstance() #617

Merged
merged 1 commit into from Sep 11, 2021
Merged

clickhouse: honor DefaultMigrationsTableEngine when created WithInstance() #617

merged 1 commit into from Sep 11, 2021

Conversation

kaworu
Copy link
Contributor

@kaworu kaworu commented Sep 6, 2021

Before this patch, clickhouse.WithInstance() would not select DefaultMigrationsTableEngine when no MigrationsTableEngine was provided through the clickhouse.Config argument. This behaviour forces the caller to always provide explicitely the config's MigrationsTableEngine.

This patch make it so DefaultMigrationsTableEngine is used when MigrationsTableEngine is not provided through clickhouse.Config.

@coveralls
Copy link

coveralls commented Sep 6, 2021

Pull Request Test Coverage Report for Build 1220557373

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 57.709%

Totals Coverage Status
Change from base Build 1165205811: 0.3%
Covered Lines: 3713
Relevant Lines: 6434

💛 - Coveralls

Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find and thanks for the PR! Only a few minor nits.

@@ -127,6 +127,10 @@ func (ch *ClickHouse) init() error {
ch.config.MultiStatementMaxSize = DefaultMultiStatementMaxSize
}

if len(ch.config.MigrationsTableEngine) == 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the odd white spacing a github issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think so, gofmt -s -w database/clickhouse/clickhouse.go yield no diff.

@@ -106,6 +106,33 @@ func testSimple(t *testing.T, engine string) {
})
}

func testSimpleWithInstance(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment that this is intended to test setting default config values with instances (or rename the test accordingly)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to testSimpleWithInstanceDefaultConfigValues.

@kaworu kaworu requested a review from dhui September 10, 2021 08:43
…nce()

Before this patch, clickhouse.WithInstance() would not select
DefaultMigrationsTableEngine when no MigrationsTableEngine was provided
through the clickhouse.Config{} argument. This behaviour forces the
caller to always provide explicitely the config's MigrationsTableEngine.

This patch make it so DefaultMigrationsTableEngine is used when
MigrationsTableEngine is not provided through clickhouse.Config{}.

Signed-off-by: Alexandre Perrin <alex@kaworu.ch>
@dhui dhui merged commit b4047a1 into golang-migrate:master Sep 11, 2021
@kaworu kaworu deleted the pr/kaworu/database/clickhouse/honor-DefaultMigrationsTableEngine branch September 11, 2021 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants