From 0dc24c87b82e8420939a6ec90fb0567bce435792 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 8 Oct 2020 16:16:49 +0200 Subject: [PATCH] FIX nuke DEFAULT CURRENT_TIMESTAMP in pgsql --- htdocs/core/db/pgsql.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 3c49bcf6f4b..d24b4e98189 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -234,8 +234,11 @@ class DoliDBPgsql extends DoliDB // on update defaulted by now $line = preg_replace('/(\s*)tms(\s*)timestamp/i', '\\1tms timestamp without time zone DEFAULT now() NOT NULL', $line); + // nuke DEFAULT CURRENT_TIMESTAMP + $line = preg_replace('/(\s*)DEFAULT(\s*)CURRENT_TIMESTAMP/i', '\\1', $line); + // nuke ON UPDATE CURRENT_TIMESTAMP - $line = preg_replace('/(\s*)on(\s*)update(\s*)CURRENT_TIMESTAMP/i', '\\1', $line); + $line = preg_replace('/(\s*)ON(\s*)UPDATE(\s*)CURRENT_TIMESTAMP/i', '\\1', $line); // unique index(field1,field2) if (preg_match('/unique index\s*\((\w+\s*,\s*\w+)\)/i', $line))