From 65efe53bfc6b66a9e0c463d18df97fc7dd8145cc Mon Sep 17 00:00:00 2001 From: alanmcruickshank Date: Wed, 13 Jul 2016 16:20:40 +0100 Subject: [PATCH] Adding in Second and Minute time grains for MySQL (#696) * Added documentation of the health check endpoint * Adding Minute and Second time grains for MySQL * Fixed Migration script so that it doesn't break when new fields added to the models for Dashboards or Slices (using declarative base) * Revert "Fixed Migration script so that it doesn't break when new fields added to the models for Dashboards or Slices (using declarative base)" This reverts commit 0b6dd696d61bc90be84807fdb6e9d4b3d91a3769. * Code Cleanliness --- caravel/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/caravel/models.py b/caravel/models.py index 31f6f1bbe9..dd8670d1ae 100644 --- a/caravel/models.py +++ b/caravel/models.py @@ -414,6 +414,11 @@ class Database(Model, AuditMixinNullable): ), 'mysql': ( Grain('Time Column', _('Time Column'), '{col}'), + Grain("second", _('second'), "DATE_ADD(DATE({col}), " + "INTERVAL (HOUR({col})*60*60 + MINUTE({col})*60" + " + SECOND({col})) SECOND)"), + Grain("minute", _('minute'), "DATE_ADD(DATE({col}), " + "INTERVAL (HOUR({col})*60 + MINUTE({col})) MINUTE)"), Grain("hour", _('hour'), "DATE_ADD(DATE({col}), " "INTERVAL HOUR({col}) HOUR)"), Grain('day', _('day'), 'DATE({col})'),