summaryrefslogtreecommitdiffstats
path: root/lib/db.php
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-10-10 23:00:46 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-10-10 23:00:46 +0200
commit7a30f465439f65a1bcec61cf61f0cf7cae6664d7 (patch)
treec768db36fc94a2873ff5754e642392a2f2f2d311 /lib/db.php
parentccf8df440504b02f5d1387b263b3f09daf09a2a2 (diff)
parent2c3674ea87c6303f8dc1345d056871ca3637b437 (diff)
downloadnextcloud-server-7a30f465439f65a1bcec61cf61f0cf7cae6664d7.tar.gz
nextcloud-server-7a30f465439f65a1bcec61cf61f0cf7cae6664d7.zip
Merge branch 'master' of github.com:owncloud/core into vcategories_db
Diffstat (limited to 'lib/db.php')
-rw-r--r--lib/db.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/db.php b/lib/db.php
index db4aca19dbe..1e0f5a1692f 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 );
}
@@ -475,7 +475,8 @@ class OC_DB {
*/
public static function updateDbFromStructure($file) {
$CONFIG_DBTABLEPREFIX = OC_Config::getValue( "dbtableprefix", "oc_" );
-
+ $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
+
self::connectScheme();
// read file
@@ -493,16 +494,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);