diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn index 70f12165a522ec225e4f147209b71e0e46bd33d9..d80f5c0123c225089bce8e0f7085ca6a4b035983 100644 --- a/.clj-kondo/config.edn +++ b/.clj-kondo/config.edn @@ -332,6 +332,7 @@ metabase.util.i18n i18n metabase.util.i18n.impl i18n.impl metabase.util.password u.password + metabase.util.schema su metabase.util.ui-logic ui-logic metabase.util.urls urls metabuild-common.core u diff --git a/resources/migrations/000_migrations.yaml b/resources/migrations/000_migrations.yaml index 110458f2c9a5ffd62f2f6859d624da5705ad06ce..d25efa4df8cf47fe34117d9227797c8da5310c8c 100644 --- a/resources/migrations/000_migrations.yaml +++ b/resources/migrations/000_migrations.yaml @@ -11637,6 +11637,161 @@ databaseChangeLog: columnName: creator_id columnDataType: int + # v44.00-002 through -011 add entity_id columns to several internal entities. + # These are fixed-width string fields populated with a random 21-character + # NanoID value, and used by the serialization system to de-duplicate entities + # in a portable way. See the serialization design doc in the design repo. + - changeSet: + id: v44.00-002 + author: braden + comment: Added 0.44.0 - add entity_id column to all internal entities + changes: + - addColumn: + columns: + - column: + remarks: Random NanoID tag for unique identity. + name: entity_id + type: char(21) + constraints: + nullable: true + unique: true + tableName: metric + - changeSet: + id: v44.00-003 + author: braden + comment: Added 0.44.0 - add entity_id column to all internal entities + changes: + - addColumn: + columns: + - column: + remarks: Random NanoID tag for unique identity. + name: entity_id + type: char(21) + constraints: + nullable: true + unique: true + tableName: segment + - changeSet: + id: v44.00-004 + author: braden + comment: Added 0.44.0 - add entity_id column to all internal entities + changes: + - addColumn: + columns: + - column: + remarks: Random NanoID tag for unique identity. + name: entity_id + type: char(21) + constraints: + nullable: true + unique: true + tableName: collection + - changeSet: + id: v44.00-005 + author: braden + comment: Added 0.44.0 - add entity_id column to all internal entities + changes: + - addColumn: + columns: + - column: + remarks: Random NanoID tag for unique identity. + name: entity_id + type: char(21) + constraints: + nullable: true + unique: true + tableName: report_dashboard + - changeSet: + id: v44.00-006 + author: braden + comment: Added 0.44.0 - add entity_id column to all internal entities + changes: + - addColumn: + columns: + - column: + remarks: Random NanoID tag for unique identity. + name: entity_id + type: char(21) + constraints: + nullable: true + unique: true + tableName: dimension + - changeSet: + id: v44.00-007 + author: braden + comment: Added 0.44.0 - add entity_id column to all internal entities + changes: + - addColumn: + columns: + - column: + remarks: Random NanoID tag for unique identity. + name: entity_id + type: char(21) + constraints: + nullable: true + unique: true + tableName: pulse + - changeSet: + id: v44.00-008 + author: braden + comment: Added 0.44.0 - add entity_id column to all internal entities + changes: + - addColumn: + columns: + - column: + remarks: Random NanoID tag for unique identity. + name: entity_id + type: char(21) + constraints: + nullable: true + unique: true + tableName: report_card + - changeSet: + id: v44.00-009 + author: braden + comment: Added 0.44.0 - add entity_id column to all internal entities + changes: + - addColumn: + columns: + - column: + remarks: Random NanoID tag for unique identity. + name: entity_id + type: char(21) + constraints: + nullable: true + unique: true + tableName: native_query_snippet + - changeSet: + id: v44.00-010 + author: braden + comment: Added 0.44.0 - add entity_id column to all internal entities + changes: + - addColumn: + columns: + - column: + remarks: Random NanoID tag for unique identity. + name: entity_id + type: char(21) + constraints: + nullable: true + unique: true + tableName: timeline + - changeSet: + id: v44.00-011 + author: braden + comment: Added 0.44.0 - add entity_id column to all internal entities + changes: + - addColumn: + columns: + - column: + remarks: Random NanoID tag for unique identity. + name: entity_id + type: char(21) + constraints: + nullable: true + unique: true + tableName: report_dashboardcard + # >>>>>>>>>> DO NOT ADD NEW MIGRATIONS BELOW THIS LINE! ADD THEM ABOVE <<<<<<<<<< ######################################################################################################################## diff --git a/src/metabase/api/collection.clj b/src/metabase/api/collection.clj index 307d276af9ab6b21b0d1f326de76e6da24faeeed..2c5da860a46d3e4cb10fdd3493cbd0e702b72f77 100644 --- a/src/metabase/api/collection.clj +++ b/src/metabase/api/collection.clj @@ -185,6 +185,7 @@ [_ collection {:keys [archived? pinned-state]}] (-> {:select [:p.id :p.name + :p.entity_id :p.collection_position [(hx/literal "pulse") :model]] :modifiers [:distinct] @@ -206,7 +207,7 @@ (defmethod collection-children-query :snippet [_ collection {:keys [archived?]}] - {:select [:id :name [(hx/literal "snippet") :model]] + {:select [:id :name :entity_id [(hx/literal "snippet") :model]] :from [[NativeQuerySnippet :nqs]] :where [:and [:= :collection_id (:id collection)] @@ -214,7 +215,7 @@ (defmethod collection-children-query :timeline [_ collection {:keys [archived? pinned-state]}] - {:select [:id :name [(hx/literal "timeline") :model] :description :icon] + {:select [:id :name [(hx/literal "timeline") :model] :description :entity_id :icon] :from [[Timeline :timeline]] :where [:and (poison-when-pinned-clause pinned-state) @@ -234,7 +235,7 @@ :moderated_status :icon :personal_owner_id))) (defn- card-query [dataset? collection {:keys [archived? pinned-state]}] - (-> {:select [:c.id :c.name :c.description :c.collection_position :c.display + (-> {:select [:c.id :c.name :c.description :c.entity_id :c.collection_position :c.display [(hx/literal (if dataset? "dataset" "card")) :model] [:u.id :last_edit_user] [:u.email :last_edit_email] [:u.first_name :last_edit_first_name] [:u.last_name :last_edit_last_name] @@ -287,7 +288,7 @@ (defmethod collection-children-query :dashboard [_ collection {:keys [archived? pinned-state]}] - (-> {:select [:d.id :d.name :d.description :d.collection_position [(hx/literal "dashboard") :model] + (-> {:select [:d.id :d.name :d.description :d.entity_id :d.collection_position [(hx/literal "dashboard") :model] [:u.id :last_edit_user] [:u.email :last_edit_email] [:u.first_name :last_edit_first_name] [:u.last_name :last_edit_last_name] [:r.timestamp :last_edit_timestamp]] @@ -323,6 +324,7 @@ :select [:id :name :description + :entity_id :personal_owner_id [(hx/literal "collection") :model] :authority_level]) @@ -398,7 +400,7 @@ "All columns that need to be present for the union-all. Generated with the comment form below. Non-text columns that are optional (not id, but last_edit_user for example) must have a type so that the union-all can unify the nil with the correct column type." - [:id :name :description :display :model :collection_position :authority_level [:personal_owner_id :integer] + [:id :name :description :entity_id :display :model :collection_position :authority_level [:personal_owner_id :integer] :last_edit_email :last_edit_first_name :last_edit_last_name :moderated_status :icon [:last_edit_user :integer] [:last_edit_timestamp :timestamp]]) @@ -429,7 +431,7 @@ ;; generate the set of columns across all child queries. Remember to add type info if not a text column (into [] (comp cat (map select-name) (distinct)) - (for [model [:card :dashboard :snippet :pulse :collection]] + (for [model [:card :dashboard :snippet :pulse :collection :timeline]] (:select (collection-children-query model {:id 1 :location "/"} nil))))) diff --git a/src/metabase/util/schema.clj b/src/metabase/util/schema.clj index eafe26fdd4451cdfde93b86908e7c3a1829ee210..0b2d709b94781a099a457ed7cea79f4e6a1ce071 100644 --- a/src/metabase/util/schema.clj +++ b/src/metabase/util/schema.clj @@ -336,3 +336,8 @@ "Schema for a valid ISO Locale code e.g. `en` or `en-US`. Case-insensitive and allows dashes or underscores." (with-api-error-message (s/constrained NonBlankString i18n/available-locale?) (deferred-tru "String must be a valid two-letter ISO language or language-country code e.g. 'en' or 'en_US'."))) + +(def NanoIdString + "Schema for a 21-character NanoID string, like \"FReCLx5hSWTBU7kjCWfuu\"." + (with-api-error-message #"^[A-Za-z0-9_\-]{21}$" + (deferred-tru "String must be a valid 21-character NanoID string."))) diff --git a/test/metabase/api/alert_test.clj b/test/metabase/api/alert_test.clj index d57d8c071a8b9598088067ea0397cc3302b9d544..7de6bb018302ea6c17a51b847cd68ce2cb86fcd2 100644 --- a/test/metabase/api/alert_test.clj +++ b/test/metabase/api/alert_test.clj @@ -254,6 +254,7 @@ (defn- default-alert [card] {:id true :name nil + :entity_id false :creator_id true :creator (user-details :rasta) :created_at true diff --git a/test/metabase/api/card_test.clj b/test/metabase/api/card_test.clj index bb2020d5592e81d6fe9ef6c79383f387ed50de51..0a3e1ce998a264184a783583b36113f9428e7da6 100644 --- a/test/metabase/api/card_test.clj +++ b/test/metabase/api/card_test.clj @@ -51,6 +51,7 @@ :description nil :display "scalar" :enable_embedding false + :entity_id nil :embedding_params nil :made_public_by_id nil :moderation_reviews () diff --git a/test/metabase/api/collection_test.clj b/test/metabase/api/collection_test.clj index a6834900cb227d44d083e35171973488c9665a66..834e6afd6954dd0535c2e9451707a7d30ea279ce 100644 --- a/test/metabase/api/collection_test.clj +++ b/test/metabase/api/collection_test.clj @@ -17,6 +17,7 @@ [metabase.test :as mt] [metabase.test.fixtures :as fixtures] [metabase.util :as u] + [metabase.util.schema :as su] [schema.core :as s] [toucan.db :as db]) (:import [java.time ZonedDateTime ZoneId])) @@ -193,6 +194,7 @@ (testing "Make sure each Collection comes back with the expected keys" (is (= {:description nil :archived false + :entity_id nil :slug "rasta_toucan_s_personal_collection" :color "#31698A" :name "Rasta Toucan's Personal Collection" @@ -222,6 +224,7 @@ (with-french-user-and-personal-collection user collection (is (= {:description nil :archived false + :entity_id nil :slug "collection_personnelle_de_taco_bell" :color "#ABCDEF" :name "Collection personnelle de Taco Bell" @@ -385,7 +388,7 @@ items)) (defn- default-item [{:keys [model] :as item-map}] - (merge {:id true, :collection_position nil} + (merge {:id true, :collection_position nil, :entity_id false} (when (= model "collection") {:authority_level nil}) (when (= model "card") @@ -398,6 +401,7 @@ :can_write (str/ends-with? collection-name "Personal Collection") :model "collection" :authority_level nil + :entity_id false :name collection-name} extra-keypairs)) @@ -418,6 +422,7 @@ :collection_position nil :display "table" :description nil + :entity_id nil :moderated_status "verified" :model "card"}]) (mt/obj->json->obj @@ -459,10 +464,10 @@ (mt/with-temp Collection [collection {:name "Debt Collection"}] (perms/grant-collection-read-permissions! (perms-group/all-users) collection) (with-some-children-of-collection collection - (is (= (map default-item [{:name "Acme Products", :model "pulse"} - {:name "Birthday Card", :description nil, :model "card", :display "table"} - {:name "Dine & Dashboard", :description nil, :model "dashboard"} - {:name "Electro-Magnetic Pulse", :model "pulse"}]) + (is (= (map default-item [{:name "Acme Products", :model "pulse", :entity_id false} + {:name "Birthday Card", :description nil, :model "card", :display "table", :entity_id false} + {:name "Dine & Dashboard", :description nil, :model "dashboard", :entity_id false} + {:name "Electro-Magnetic Pulse", :model "pulse", :entity_id false}]) (mt/boolean-ids-and-timestamps (:data (mt/user-http-request :rasta :get 200 (str "collection/" (u/the-id collection) "/items")))))))) @@ -473,11 +478,11 @@ (is (= () (mt/boolean-ids-and-timestamps (:data (mt/user-http-request :rasta :get 200 (str "collection/" (u/the-id collection) "/items?models=no_models")))))) - (is (= [(default-item {:name "Dine & Dashboard", :description nil, :model "dashboard"})] + (is (= [(default-item {:name "Dine & Dashboard", :description nil, :model "dashboard", :entity_id false})] (mt/boolean-ids-and-timestamps (:data (mt/user-http-request :rasta :get 200 (str "collection/" (u/the-id collection) "/items?models=dashboard")))))) - (is (= [(default-item {:name "Birthday Card", :description nil, :model "card", :display "table"}) - (default-item {:name "Dine & Dashboard", :description nil, :model "dashboard"})] + (is (= [(default-item {:name "Birthday Card", :description nil, :model "card", :display "table", :entity_id false}) + (default-item {:name "Dine & Dashboard", :description nil, :model "dashboard", :entity_id false})] (mt/boolean-ids-and-timestamps (:data (mt/user-http-request :rasta :get 200 (str "collection/" (u/the-id collection) "/items?models=dashboard&models=card")))))))))) @@ -487,7 +492,7 @@ (perms/grant-collection-read-permissions! (perms-group/all-users) collection) (with-some-children-of-collection collection (db/update-where! Dashboard {:collection_id (u/the-id collection)} :archived true) - (is (= [(default-item {:name "Dine & Dashboard", :description nil, :model "dashboard"})] + (is (= [(default-item {:name "Dine & Dashboard", :description nil, :model "dashboard", :entity_id false})] (mt/boolean-ids-and-timestamps (:data (mt/user-http-request :rasta :get 200 (str "collection/" (u/the-id collection) "/items?archived=true"))))))))) (mt/with-temp* [Collection [{collection-id :id} {:name "Collection with Items"}] @@ -697,21 +702,24 @@ (mt/with-temp* [Collection [{collection-id :id} {:namespace "snippets", :name "My Snippet Collection"}] NativeQuerySnippet [{snippet-id :id} {:collection_id collection-id, :name "My Snippet"}] NativeQuerySnippet [{archived-id :id} {:collection_id collection-id, :name "Archived Snippet", :archived true}]] - (is (= [{:id snippet-id - :name "My Snippet" - :model "snippet"}] + (is (= [{:id snippet-id + :name "My Snippet" + :entity_id nil + :model "snippet"}] (:data (mt/user-http-request :rasta :get 200 (format "collection/%d/items" collection-id))))) (testing "\nShould be able to fetch archived Snippets" - (is (= [{:id archived-id - :name "Archived Snippet" - :model "snippet"}] + (is (= [{:id archived-id + :name "Archived Snippet" + :entity_id nil + :model "snippet"}] (:data (mt/user-http-request :rasta :get 200 (format "collection/%d/items?archived=true" collection-id)))))) (testing "\nShould be able to pass ?model=snippet, even though it makes no difference in this case" - (is (= [{:id snippet-id - :name "My Snippet" - :model "snippet"}] + (is (= [{:id snippet-id + :name "My Snippet" + :entity_id nil + :model "snippet"}] (:data (mt/user-http-request :rasta :get 200 (format "collection/%d/items?model=snippet" collection-id)))))))))) @@ -732,6 +740,7 @@ :can_write true}] :effective_location "/" :parent_id nil + :entity_id nil :id (u/the-id (collection/user->personal-collection (mt/user->id :lucky))) :location "/"})) @@ -979,6 +988,7 @@ :description nil :model "collection" :authority_level nil + :entity_id nil :can_write true}] (->> (:data (mt/user-http-request :rasta :get 200 "collection/root/items")) (filter #(str/includes? (:name %) "Personal Collection"))))) @@ -990,6 +1000,7 @@ :description nil :model "collection" :authority_level nil + :entity_id nil :can_write true}] (->> (:data (mt/user-http-request user :get 200 "collection/root/items")) (filter #(str/includes? (:name %) "Taco Bell")))))))) @@ -1000,6 +1011,7 @@ :description nil :model "collection" :authority_level nil + :entity_id nil :can_write true}] (->> (:data (mt/user-http-request :crowberto :get 200 "collection/root/items")) (filter #(str/includes? (:name %) "Personal Collection"))))) @@ -1013,6 +1025,7 @@ :description nil :model "collection" :authority_level nil + :entity_id nil :can_write true}] (->> (:data (mt/user-http-request :crowberto :get 200 "collection/root/items")) (filter #(str/includes? (:name %) "Personal Collection"))))))) @@ -1024,6 +1037,7 @@ :collection_position nil :display "table" :moderated_status nil + :entity_id nil :model "card"}] (for [item (:data (mt/user-http-request :crowberto :get 200 "collection/root/items?archived=true"))] (dissoc item :id))))))))) @@ -1106,10 +1120,10 @@ (deftest root-collection-snippets-test (testing "GET /api/collection/root/items?namespace=snippets" (testing "\nNative query snippets should come back when fetching the items in the root Collection of the `:snippets` namespace" - (mt/with-temp* [NativeQuerySnippet [{snippet-id :id} {:name "My Snippet"}] - NativeQuerySnippet [{snippet-id-2 :id} {:name "My Snippet 2"}] - NativeQuerySnippet [{archived-id :id} {:name "Archived Snippet", :archived true}] - Dashboard [{dashboard-id :id} {:name "My Dashboard"}]] + (mt/with-temp* [NativeQuerySnippet [{snippet-id :id} {:name "My Snippet", :entity_id nil}] + NativeQuerySnippet [{snippet-id-2 :id} {:name "My Snippet 2", :entity_id nil}] + NativeQuerySnippet [{archived-id :id} {:name "Archived Snippet", :archived true, :entity_id nil}] + Dashboard [{dashboard-id :id} {:name "My Dashboard", :entity_id nil}]] (letfn [(only-test-items [results] (if (sequential? results) (filter #(#{["snippet" snippet-id] @@ -1123,12 +1137,14 @@ (if (sequential? items) (map :name items) items)))] - (is (= [{:id snippet-id - :name "My Snippet" - :model "snippet"} - {:id snippet-id-2 - :name "My Snippet 2" - :model "snippet"}] + (is (= [{:id snippet-id + :name "My Snippet" + :entity_id nil + :model "snippet"} + {:id snippet-id-2 + :name "My Snippet 2" + :entity_id nil + :model "snippet"}] (only-test-items (:data (mt/user-http-request :rasta :get 200 "collection/root/items?namespace=snippets"))))) (testing "\nSnippets should not come back for the default namespace" @@ -1235,7 +1251,8 @@ :personal_owner_id (s/eq nil) :authority_level (s/eq "official") :id s/Int - :location (s/eq "/") + :location (s/eq "/") + :entity_id (s/maybe su/NanoIdString) :namespace (s/eq nil)} (mt/user-http-request :crowberto :post 200 "collection" {:name "foo", :color "#f38630", :authority_level "official"}))) diff --git a/test/metabase/api/dashboard_test.clj b/test/metabase/api/dashboard_test.clj index a55f803b12411363654189c4d36d331a633c68d9..cef37d1932e855f93800773c62495cb17196eaac 100644 --- a/test/metabase/api/dashboard_test.clj +++ b/test/metabase/api/dashboard_test.clj @@ -125,6 +125,7 @@ :description nil :embedding_params nil :enable_embedding false + :entity_id nil :made_public_by_id nil :parameters [] :points_of_interest nil @@ -225,6 +226,7 @@ :collection_authority_level nil :updated_at true :created_at true + :entity_id nil :parameter_mappings [] :visualization_settings {} :card (merge api.card-test/card-defaults-no-hydrate @@ -270,6 +272,7 @@ :row 0 :updated_at true :created_at true + :entity_id nil :collection_authority_level nil :parameter_mappings [{:card_id 1 :parameter_id "foo" @@ -704,6 +707,7 @@ :series [] :parameter_mappings [{:card-id 123, :hash "abc", :target "foo"}] :visualization_settings {} + :entity_id nil :created_at true :updated_at true} (-> (mt/user-http-request :rasta :post 200 (format "dashboard/%d/cards" dashboard-id) diff --git a/test/metabase/api/field_test.clj b/test/metabase/api/field_test.clj index 13e8b196cb98bd2fcd020998d789fc2cb815eabe..1d298dce55a90982834ee831c63c9d06bcfc947b 100644 --- a/test/metabase/api/field_test.clj +++ b/test/metabase/api/field_test.clj @@ -350,6 +350,7 @@ (create-dimension-via-API! field-id {:name "some dimension name", :type "internal"}) (let [new-dim (dimension-for-field field-id)] (is (= {:id true + :entity_id false :created_at true :updated_at true :type :internal @@ -361,6 +362,7 @@ (create-dimension-via-API! field-id {:name "different dimension name", :type "internal"}) (let [updated-dim (dimension-for-field field-id)] (is (= {:id true + :entity_id false :created_at true :updated_at true :type :internal @@ -388,6 +390,7 @@ {:name "some dimension name", :type "external" :human_readable_field_id field-id-2}) (testing "after creation" (is (= {:id true + :entity_id false :created_at true :updated_at true :type :external @@ -418,6 +421,7 @@ (create-dimension-via-API! field-id {:name "some dimension name", :type "internal"}) (testing "before deletion" (is (= {:id true + :entity_id false :created_at true :updated_at true :type :internal @@ -447,6 +451,7 @@ {:name "fk-remove-dimension", :type "external" :human_readable_field_id field-id-2}) (testing "before update" (is (= {:id true + :entity_id false :created_at true :updated_at true :type :external @@ -469,6 +474,7 @@ (create-dimension-via-API! field-id-1 {:name "fk-remove-dimension", :type "external" :human_readable_field_id field-id-2}) (let [expected {:id true + :entity_id false :created_at true :updated_at true :type :external @@ -603,6 +609,7 @@ (create-dimension-via-API! field-id {:name "some dimension name", :type "internal"}) (testing "before API request" (is (= {:id true + :entity_id false :created_at true :updated_at true :type :internal @@ -620,6 +627,7 @@ :base_type "type/Integer"}] (create-dimension-via-API! field-id {:name "some dimension name", :type "internal"}) (let [expected {:id true + :entity_id false :created_at true :updated_at true :type :internal diff --git a/test/metabase/api/metric_test.clj b/test/metabase/api/metric_test.clj index db127fc910098a693d717632a0ef18402a73284e..0f04a5f318b067c386cbb964641b0579babdf9b8 100644 --- a/test/metabase/api/metric_test.clj +++ b/test/metabase/api/metric_test.clj @@ -26,6 +26,7 @@ :created_at true :updated_at true :archived false + :entity_id nil :definition nil}) (defn- user-details [user] diff --git a/test/metabase/api/pulse_test.clj b/test/metabase/api/pulse_test.clj index 733a7d081846b44a7e6833eb0574ad629cfdb1c4..8cbd7eb2af66ef93b2e5aec15f486b23c4ed30d9 100644 --- a/test/metabase/api/pulse_test.clj +++ b/test/metabase/api/pulse_test.clj @@ -46,7 +46,8 @@ (merge (select-keys pulse - [:id :name :created_at :updated_at :creator_id :collection_id :collection_position :archived :skip_if_empty :dashboard_id :parameters]) + [:id :name :created_at :updated_at :creator_id :collection_id :collection_position :entity_id :archived + :skip_if_empty :dashboard_id :parameters]) {:creator (user-details (db/select-one 'User :id (:creator_id pulse))) :cards (map pulse-card-details (:cards pulse)) :channels (map pulse-channel-details (:channels pulse))})) @@ -149,6 +150,7 @@ :updated_at true :archived false :dashboard_id nil + :entity_id nil :parameters []}) (def ^:private daily-email-channel diff --git a/test/metabase/api/segment_test.clj b/test/metabase/api/segment_test.clj index 636a9c7741d2c36bb8fe1d7c8d9389d395adee66..2a2e48054ef4b528196aba7b5cabb5d6b2633c26 100644 --- a/test/metabase/api/segment_test.clj +++ b/test/metabase/api/segment_test.clj @@ -80,6 +80,7 @@ :points_of_interest nil :creator_id (mt/user->id :crowberto) :creator (user-details (mt/fetch-user :crowberto)) + :entity_id nil :created_at true :updated_at true :archived false @@ -135,6 +136,7 @@ :points_of_interest nil :creator_id (mt/user->id :rasta) :creator (user-details (mt/fetch-user :rasta)) + :entity_id nil :created_at true :updated_at true :archived false @@ -216,6 +218,7 @@ :creator (user-details (mt/fetch-user :rasta)) :created_at true :updated_at true + :entity_id nil :archived true :definition nil} (-> (mt/user-http-request :crowberto :get 200 (format "segment/%d" id)) @@ -251,6 +254,7 @@ :creator (user-details (mt/fetch-user :crowberto)) :created_at true :updated_at true + :entity_id nil :archived false :definition {:filter ["=" ["field" 2 nil] "cans"]}} (-> (mt/user-http-request :rasta :get 200 (format "segment/%d" id)) diff --git a/test/metabase/api/table_test.clj b/test/metabase/api/table_test.clj index ee5e239fae5500d5acab584d14979dbfe8dd2989..25a0c42d589660b46fde9b4f3512dc8fd66e19cc 100644 --- a/test/metabase/api/table_test.clj +++ b/test/metabase/api/table_test.clj @@ -602,7 +602,9 @@ :name "CATEGORY_ID" :dimensions {:name "Category ID [internal remap]" :field_id (mt/id :venues :category_id) - :human_readable_field_id nil, :type "internal"}} + :human_readable_field_id nil + :type "internal" + :entity_id nil}} {:id (mt/id :venues :price) :table_id (mt/id :venues) :name "PRICE" @@ -619,7 +621,9 @@ :name "CATEGORY_ID" :dimensions {:name "Category ID [internal remap]" :field_id (mt/id :venues :category_id) - :human_readable_field_id nil, :type "internal"}} + :human_readable_field_id nil + :type "internal" + :entity_id nil}} {:id (mt/id :venues :price) :table_id (mt/id :venues) :name "PRICE" @@ -638,7 +642,8 @@ :dimensions {:name "Category ID [external remap]" :field_id (mt/id :venues :category_id) :human_readable_field_id (mt/id :categories :name) - :type "external"}} + :type "external" + :entity_id nil}} {:id (mt/id :venues :price) :table_id (mt/id :venues) :name "PRICE" diff --git a/test/metabase/events/revision_test.clj b/test/metabase/events/revision_test.clj index 309f14463fe5186d435a97283a0cf86501d710e9..657468c042a056e240dc8361dc20af4909df37e9 100644 --- a/test/metabase/events/revision_test.clj +++ b/test/metabase/events/revision_test.clj @@ -27,6 +27,7 @@ :description nil :display :table :enable_embedding false + :entity_id nil :embedding_params nil :id (u/the-id card) :made_public_by_id nil @@ -188,6 +189,7 @@ :user_id (mt/user->id :rasta) :object {:name "Toucans in the rainforest" :description "Lookin' for a blueberry" + :entity_id nil :how_is_this_calculated nil :show_in_getting_started false :caveats nil @@ -217,6 +219,7 @@ :user_id (mt/user->id :crowberto) :object {:name "Toucans in the rainforest" :description "Lookin' for a blueberry" + :entity_id nil :how_is_this_calculated nil :show_in_getting_started false :caveats nil @@ -247,6 +250,7 @@ :how_is_this_calculated nil :show_in_getting_started false :caveats nil + :entity_id nil :points_of_interest nil :archived true :creator_id (mt/user->id :rasta) @@ -275,6 +279,7 @@ :show_in_getting_started false :caveats nil :points_of_interest nil + :entity_id nil :archived false :creator_id (mt/user->id :rasta) :definition {:a "b"}} @@ -301,6 +306,7 @@ :show_in_getting_started false :caveats nil :points_of_interest nil + :entity_id nil :archived false :creator_id (mt/user->id :rasta) :definition {:a "b"}} @@ -329,6 +335,7 @@ :show_in_getting_started false :caveats nil :points_of_interest nil + :entity_id nil :archived true :creator_id (mt/user->id :rasta) :definition {:a "b"}} diff --git a/test/metabase/models/metric_test.clj b/test/metabase/models/metric_test.clj index 84d859dde8e98570d2dbd15ca64f0bf4c315ba2f..e4038866f93bd72721810f8cb5f3b70f31c87c88 100644 --- a/test/metabase/models/metric_test.clj +++ b/test/metabase/models/metric_test.clj @@ -14,6 +14,7 @@ :caveats nil :points_of_interest nil :archived false + :entity_id nil :definition nil}) (defn- user-details diff --git a/test/metabase/models/pulse_test.clj b/test/metabase/models/pulse_test.clj index 3115591459b99269c05fa648790ac64f9eae83d2..caa4691174f7d95a4aaed596b99db878cf8a492f 100644 --- a/test/metabase/models/pulse_test.clj +++ b/test/metabase/models/pulse_test.clj @@ -66,6 +66,7 @@ {:creator_id (mt/user->id :rasta) :creator (user-details :rasta) :name "Lodi Dodi" + :entity_id nil :cards [{:name "Test Card" :description nil :collection_id nil @@ -143,6 +144,7 @@ pulse-defaults {:creator_id (mt/user->id :rasta) :name "Booyah!" + :entity_id nil :channels [(merge pulse-channel-defaults {:schedule_type :daily :schedule_hour 18 @@ -211,6 +213,7 @@ (is (= (merge pulse-defaults {:creator_id (mt/user->id :rasta) :name "We like to party" + :entity_id nil :cards [{:name "Bar Card" :description nil :collection_id nil diff --git a/test/metabase/models/segment_test.clj b/test/metabase/models/segment_test.clj index 1402310f36fbe054cc32ab0104c7fce69cedf19e..8c29a6da29041e3bba7c8a6d16cc36e20af2efe2 100644 --- a/test/metabase/models/segment_test.clj +++ b/test/metabase/models/segment_test.clj @@ -43,7 +43,8 @@ :caveats nil :points_of_interest nil :archived false - :definition nil}] + :definition nil + :entity_id nil}] (for [segment (u/prog1 (segment/retrieve-segments table-id-1) (assert (= 1 (count <>))))] (-> (dissoc (into {} segment) :id :table_id :created_at :updated_at) @@ -62,6 +63,7 @@ :show_in_getting_started false :caveats nil :points_of_interest nil + :entity_id nil :definition {:filter [:> [:field 4 nil] "2014-10-19"]} :archived false} (into {} (-> (#'segment/serialize-segment Segment (:id segment) segment)