summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2012-10-08 17:24:15 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2012-10-08 17:24:15 +0200
commitdc116b994d7749a2c0cb2c3c1f0f5ad8f028a3d0 (patch)
tree84449fc132e909596867ac8cf3180be3e78fa134
parentb296328c61494eaa21f054838ebbef038558aa11 (diff)
downloadnextcloud-server-dc116b994d7749a2c0cb2c3c1f0f5ad8f028a3d0.tar.gz
nextcloud-server-dc116b994d7749a2c0cb2c3c1f0f5ad8f028a3d0.zip
reenable hack to use CURRENT_TIMESTAMP for postgresql when creating the database, fixes oc-1852
TODO for OC5: use CURRENT_TIMESTAMP for all databases. mysql supports it as a default for DATETIME since 5.6.5 [1] as a fallback we could use <default>0000-01-01 00:00:00</default> everywhere [1] http://bugs.mysql.com/bug.php?id=27645 http://dev.mysql.com/doc/refman/5.0/en/timestamp-initialization.html http://www.postgresql.org/docs/8.1/static/functions-datetime.html http://www.sqlite.org/lang_createtable.html http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions037.htm
-rw-r--r--lib/db.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/db.php b/lib/db.php
index 256ae5b6bf3..54d9a63fbce 100644
--- a/lib/db.php
+++ b/lib/db.php
@@ -427,14 +427,14 @@ class OC_DB {
$file2 = 'static://db_scheme';
$content = str_replace( '*dbname*', $CONFIG_DBNAME, $content );
$content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content );
- /* FIXME: REMOVE this commented code
- * actually mysql, postgresql, sqlite and oracle support CURRENT_TIMESTAMP
+ /* FIXME: use CURRENT_TIMESTAMP for all databases. mysql supports it as a default for DATETIME since 5.6.5 [1]
+ * as a fallback we could use <default>0000-01-01 00:00:00</default> everywhere
+ * [1] http://bugs.mysql.com/bug.php?id=27645
* http://dev.mysql.com/doc/refman/5.0/en/timestamp-initialization.html
* http://www.postgresql.org/docs/8.1/static/functions-datetime.html
* http://www.sqlite.org/lang_createtable.html
* http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions037.htm
*/
-
if( $CONFIG_DBTYPE == 'pgsql' ) { //mysql support it too but sqlite doesn't
$content = str_replace( '<default>0000-00-00 00:00:00</default>', '<default>CURRENT_TIMESTAMP</default>', $content );
}
@@ -493,16 +493,17 @@ class OC_DB {
$file2 = 'static://db_scheme';
$content = str_replace( '*dbname*', $previousSchema['name'], $content );
$content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content );
- /* FIXME: REMOVE this commented code
- * actually mysql, postgresql, sqlite and oracle support CUURENT_TIMESTAMP
+ /* FIXME: use CURRENT_TIMESTAMP for all databases. mysql supports it as a default for DATETIME since 5.6.5 [1]
+ * as a fallback we could use <default>0000-01-01 00:00:00</default> everywhere
+ * [1] http://bugs.mysql.com/bug.php?id=27645
* http://dev.mysql.com/doc/refman/5.0/en/timestamp-initialization.html
* http://www.postgresql.org/docs/8.1/static/functions-datetime.html
* http://www.sqlite.org/lang_createtable.html
* http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions037.htm
+ */
if( $CONFIG_DBTYPE == 'pgsql' ) { //mysql support it too but sqlite doesn't
$content = str_replace( '<default>0000-00-00 00:00:00</default>', '<default>CURRENT_TIMESTAMP</default>', $content );
}
- */
file_put_contents( $file2, $content );
$op = self::$schema->updateDatabase($file2, $previousSchema, array(), false);