Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

fix: match filter names in metabase.driver.sync (#63114)

Filipe Silvac5fbd85f0b70
diff --git a/enterprise/backend/src/metabase_enterprise/database_replication/api.clj b/enterprise/backend/src/metabase_enterprise/database_replication/api.clj
index 5eda9ef4e12..d7b735de749 100644
--- a/enterprise/backend/src/metabase_enterprise/database_replication/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/database_replication/api.clj
@@ -41,8 +41,8 @@
(constantly true)
(let [pat (driver.s/schema-pattern->re-pattern patterns)
f (case type
- "include" some?
- "exclude" nil?)]
+ "inclusion" some?
+ "exclusion" nil?)]
(fn [table-schema]
(f (re-matches pat table-schema))))))
@@ -137,7 +137,7 @@
[:replicationSchemaFilters
{:optional true}
[:map
- [:schema-filters-type [:enum "include" "exclude" "all"]]
+ [:schema-filters-type [:enum "inclusion" "exclusion" "all"]]
[:schema-filters-patterns :string]]]])
(api.macros/defendpoint :post "/connection/:database-id/preview"
diff --git a/enterprise/backend/test/metabase_enterprise/database_replication/api_test.clj b/enterprise/backend/test/metabase_enterprise/database_replication/api_test.clj
index ea49f869f23..cf397e33498 100644
--- a/enterprise/backend/test/metabase_enterprise/database_replication/api_test.clj
+++ b/enterprise/backend/test/metabase_enterprise/database_replication/api_test.clj
@@ -102,7 +102,7 @@
(mt/with-temporary-setting-values [is-hosted? true, store-api-url "foo", api-key "foo", database-replication-connections {}]
(mt/with-temp [:model/Database db {:engine :postgres :details db-details}]
(let [url (str "ee/database-replication/connection/" (:id db))
- body {:replicationSchemaFilters {:schema-filters-type "exclude"
+ body {:replicationSchemaFilters {:schema-filters-type "exclusion"
:schema-filters-patterns "not_pub*"}}]
(testing "previews"
(let [resp (mt/user-http-request :crowberto :post 200 (str url "/preview") body)]
@@ -132,7 +132,7 @@
(is (= (dissoc hm-conn :id)
{:type "pg_replication",
:secret {:credentials (assoc db-details :port 5432 :dbtype "postgresql")
- :schema-filters [{:type "exclude", :patterns "not_pub*"}]}}))))
+ :schema-filters [{:type "exclusion", :patterns "not_pub*"}]}}))))
(testing "deletes"
(mt/user-http-request :crowberto :delete 204 url)
(is (= 0 (count @hm-state)))
diff --git a/enterprise/frontend/src/metabase-enterprise/api/database-replication.ts b/enterprise/frontend/src/metabase-enterprise/api/database-replication.ts
index e2b2e4db0b1..0f104403957 100644
--- a/enterprise/frontend/src/metabase-enterprise/api/database-replication.ts
+++ b/enterprise/frontend/src/metabase-enterprise/api/database-replication.ts
@@ -32,7 +32,7 @@ export interface PreviewDatabaseReplicationResponse {
}
export interface ReplicationSchemaFilters {
- "schema-filters-type": "include" | "exclude" | "all";
+ "schema-filters-type": "inclusion" | "exclusion" | "all";
"schema-filters-patterns": string;
}
diff --git a/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationForm.tsx b/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationForm.tsx
index 385ce23afd0..0263b94f3af 100644
--- a/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationForm.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationForm.tsx
@@ -37,12 +37,12 @@ import type { Database, DatabaseId } from "metabase-types/api";
export interface DatabaseReplicationFormFields {
databaseId: DatabaseId;
- schemaFiltersType: "all" | "include" | "exclude";
+ schemaFiltersType: "all" | "inclusion" | "exclusion";
schemaFiltersPatterns: string;
}
const validationSchema = Yup.object({
- schemaFiltersType: Yup.string().oneOf(["all", "include", "exclude"]),
+ schemaFiltersType: Yup.string().oneOf(["all", "inclusion", "exclusion"]),
schemaFiltersPatterns: Yup.string(),
});
@@ -174,8 +174,8 @@ export const DatabaseReplicationForm = ({
}
data={[
{ value: "all", label: t`All` },
- { value: "include", label: t`Only these…` },
- { value: "exclude", label: t`All except…` },
+ { value: "inclusion", label: t`Only these…` },
+ { value: "exclusion", label: t`All except…` },
]}
/>
@@ -184,7 +184,7 @@ export const DatabaseReplicationForm = ({
<Text c="text-secondary" fz="sm">{c(
"{0} is either NOT or empty string",
)
- .t`Comma separated names of schemas that should ${values.schemaFiltersType === "exclude" ? "NOT " : ""}be replicated`}</Text>
+ .t`Comma separated names of schemas that should ${values.schemaFiltersType === "exclusion" ? "NOT " : ""}be replicated`}</Text>
<FormTextarea
name="schemaFiltersPatterns"
placeholder={t`e.g. public, auth`}
diff --git a/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationModal.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationModal.unit.spec.tsx
index 7bef74d4f7a..f02280f0c20 100644
--- a/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationModal.unit.spec.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/database_replication/DatabaseReplicationModal.unit.spec.tsx
@@ -84,7 +84,7 @@ describe("DatabaseReplicationForm", () => {
screen.queryByPlaceholderText("e.g. public, auth"),
).not.toBeInTheDocument();
- // Change to "include"
+ // Change to "inclusion"
const select = screen.getByLabelText("Select schemas to replicate");
await user.click(select);
await user.click(screen.getByText("Only these…"));
@@ -100,7 +100,7 @@ describe("DatabaseReplicationForm", () => {
).toBeInTheDocument();
});
- it("shows correct text for exclude option", async () => {
+ it("shows correct text for exclusion option", async () => {
const { user } = await setup();
const select = screen.getByLabelText("Select schemas to replicate");
@@ -135,7 +135,7 @@ describe("DatabaseReplicationForm", () => {
method: "POST",
body: {
replicationSchemaFilters: {
- "schema-filters-type": "include",
+ "schema-filters-type": "inclusion",
"schema-filters-patterns": "public",
},
},
@@ -211,7 +211,7 @@ describe("DatabaseReplicationForm", () => {
const { user } = await setup({ previewResponse: previewResponseWithError });
- // Change to "include" to show textarea
+ // Change to "inclusion" to show textarea
const select = screen.getByLabelText("Select schemas to replicate");
await user.click(select);
await user.click(screen.getByText("Only these…"));