[Pkg-owncloud-commits] [owncloud] 01/13: Oracle-specific workaround for adding a column with not-null default value

David Prévot taffit at moszumanska.debian.org
Tue Jul 7 12:42:47 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit ed1565e18c86f1d9847a42c76951e82004cfddf0
Author: Victor Dubiniuk <victor.dubiniuk at gmail.com>
Date:   Tue Jun 23 18:28:29 2015 +0300

    Oracle-specific workaround for adding a column with not-null default value
---
 apps/files_trashbin/appinfo/preupdate.php | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/apps/files_trashbin/appinfo/preupdate.php b/apps/files_trashbin/appinfo/preupdate.php
new file mode 100644
index 0000000..fc3b1c7
--- /dev/null
+++ b/apps/files_trashbin/appinfo/preupdate.php
@@ -0,0 +1,21 @@
+<?php
+
+$installedVersion=OCP\Config::getAppValue('files_trashbin', 'installed_version');
+if (version_compare($installedVersion, '0.5', '<=')) {
+	$connection = OC_DB::getConnection();
+	$platform = $connection->getDatabasePlatform();
+	if ($platform->getName() === 'oracle') {
+		try {
+			$connection->beginTransaction();
+			$sql1 = 'ALTER TABLE `*PREFIX*files_trash` ADD `auto_id` NUMBER(10) DEFAULT NULL';
+			\OC_DB::executeAudited($sql1, array());
+			$sql2 = 'CREATE SEQUENCE `*PREFIX*files_trash_seq` start with 1 increment by 1 nomaxvalue';
+			\OC_DB::executeAudited($sql2, array());
+			$sql3 = 'UPDATE `*PREFIX*files_trash` SET `auto_id` = `*PREFIX*files_trash_seq`.nextval';
+			\OC_DB::executeAudited($sql3, array());
+			$connection->commit();
+		} catch (\DatabaseException $e) {
+			\OCP\Util::writeLog('files_trashbin', "Oracle upgrade fixup failed: " . $e->getMessage(), \OCP\Util::WARN);
+		}
+	}
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list