From ed1565e18c86f1d9847a42c76951e82004cfddf0 Mon Sep 17 00:00:00 2001 From: Victor Dubiniuk Date: Tue, 23 Jun 2015 18:28:29 +0300 Subject: Oracle-specific workaround for adding a column with not-null default value --- apps/files_trashbin/appinfo/preupdate.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 apps/files_trashbin/appinfo/preupdate.php diff --git a/apps/files_trashbin/appinfo/preupdate.php b/apps/files_trashbin/appinfo/preupdate.php new file mode 100644 index 00000000000..fc3b1c77008 --- /dev/null +++ b/apps/files_trashbin/appinfo/preupdate.php @@ -0,0 +1,21 @@ +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); + } + } +} -- cgit v1.2.3