From 405600a331d313a7bd5056c7c72c8c18111205a7 Mon Sep 17 00:00:00 2001 From: Jerome Quere Date: Fri, 17 Nov 2023 17:11:27 +0100 Subject: [PATCH] Skip clickhouse materialized view inner table in drop --- .goreleaser.yml | 48 +------------------------------ database/clickhouse/clickhouse.go | 4 +++ 2 files changed, 5 insertions(+), 47 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 65d80468d..508dac624 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -20,7 +20,7 @@ builds: ldflags: - '-w -s -X main.Version={{ .Version }} -extldflags "static"' flags: - - "-tags={{ .Env.DATABASE }} {{ .Env.SOURCE }}" + - "-tags=postgres clickhouse" - "-trimpath" nfpms: - homepage: "https://github.com/golang-migrate/migrate" @@ -30,51 +30,6 @@ nfpms: formats: - deb file_name_template: "{{ .ProjectName }}.{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" -dockers: - - goos: linux - goarch: amd64 - dockerfile: Dockerfile.github-actions - use: buildx - ids: - - migrate - image_templates: - - 'migrate/migrate:{{ .Tag }}-amd64' - build_flag_templates: - - '--label=org.opencontainers.image.created={{ .Date }}' - - '--label=org.opencontainers.image.title={{ .ProjectName }}' - - '--label=org.opencontainers.image.revision={{ .FullCommit }}' - - '--label=org.opencontainers.image.version={{ .Version }}' - - "--label=org.opencontainers.image.source={{ .GitURL }}" - - "--platform=linux/amd64" - - goos: linux - goarch: arm64 - dockerfile: Dockerfile.github-actions - use: buildx - ids: - - migrate - image_templates: - - 'migrate/migrate:{{ .Tag }}-arm64' - build_flag_templates: - - '--label=org.opencontainers.image.created={{ .Date }}' - - '--label=org.opencontainers.image.title={{ .ProjectName }}' - - '--label=org.opencontainers.image.revision={{ .FullCommit }}' - - '--label=org.opencontainers.image.version={{ .Version }}' - - "--label=org.opencontainers.image.source={{ .GitURL }}" - - "--platform=linux/arm64" - -docker_manifests: -- name_template: 'migrate/migrate:{{ .Tag }}' - image_templates: - - 'migrate/migrate:{{ .Tag }}-amd64' - - 'migrate/migrate:{{ .Tag }}-arm64' -- name_template: 'migrate/migrate:{{ .Major }}' - image_templates: - - 'migrate/migrate:{{ .Tag }}-amd64' - - 'migrate/migrate:{{ .Tag }}-arm64' -- name_template: 'migrate/migrate:latest' - image_templates: - - 'migrate/migrate:{{ .Tag }}-amd64' - - 'migrate/migrate:{{ .Tag }}-arm64' archives: - name_template: "{{ .ProjectName }}.{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" format_overrides: @@ -87,7 +42,6 @@ release: prerelease: auto source: enabled: true - rlcp: true format: zip changelog: skip: false diff --git a/database/clickhouse/clickhouse.go b/database/clickhouse/clickhouse.go index ee1ac209f..15964f6a2 100644 --- a/database/clickhouse/clickhouse.go +++ b/database/clickhouse/clickhouse.go @@ -277,6 +277,10 @@ func (ch *ClickHouse) Drop() (err error) { return err } + if strings.HasPrefix(table, ".inner_id.") { + continue + } + query = "DROP TABLE IF EXISTS " + ch.config.DatabaseName + "." + table if _, err := ch.conn.Exec(query); err != nil {