From dcf76b114bdc65b447a8d53a7dd5ed77d6462338 Mon Sep 17 00:00:00 2001 From: Ryan Senior <ryan@metabase.com> Date: Fri, 2 Jun 2017 14:38:17 -0500 Subject: [PATCH] Added auditing columns to the dimensions table --- resources/migrations/000_migrations.yaml | 12 ++++++++++++ src/metabase/models/dimensions.clj | 3 ++- test/metabase/api/table_test.clj | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/resources/migrations/000_migrations.yaml b/resources/migrations/000_migrations.yaml index f23f5140e35..effa4ca930f 100644 --- a/resources/migrations/000_migrations.yaml +++ b/resources/migrations/000_migrations.yaml @@ -3717,6 +3717,18 @@ databaseChangeLog: initiallyDeferred: false nullable: true references: metabase_field(id) + - column: + name: created_at + type: DATETIME + remarks: 'The timestamp of when the dimension was created.' + constraints: + nullable: false + - column: + name: updated_at + type: DATETIME + remarks: 'The timestamp of when these dimension was last updated.' + constraints: + nullable: false - addUniqueConstraint: tableName: dimensions columnNames: field_id, name diff --git a/src/metabase/models/dimensions.clj b/src/metabase/models/dimensions.clj index c51046defe7..d084da7bbe6 100644 --- a/src/metabase/models/dimensions.clj +++ b/src/metabase/models/dimensions.clj @@ -12,4 +12,5 @@ (u/strict-extend (class Dimensions) models/IModel (merge models/IModelDefaults - {:types (constantly {:type :keyword})})) + {:types (constantly {:type :keyword}) + :properties (constantly {:timestamped? true})})) diff --git a/test/metabase/api/table_test.clj b/test/metabase/api/table_test.clj index c5476ce042c..0f1356135a0 100644 --- a/test/metabase/api/table_test.clj +++ b/test/metabase/api/table_test.clj @@ -545,7 +545,7 @@ (select-keys [:id :table_id :name :values :dimensions]) (update :dimensions (fn [dim] (if (map? dim) - (dissoc dim :id) + (dissoc dim :id :created_at :updated_at) dim)))))) ;; ## GET /api/table/:id/query_metadata -- GitLab