diff options
author | C. Montero Luque <cmonteroluque@users.noreply.github.com> | 2015-07-02 15:26:00 -0400 |
---|---|---|
committer | C. Montero Luque <cmonteroluque@users.noreply.github.com> | 2015-07-02 15:26:00 -0400 |
commit | 84b1253def9edb26d8643282cf4536e237a31a58 (patch) | |
tree | feb1d0d91d77527b5c384dc51dfb503dafb7ca7a | |
parent | 065bcf4790b30a027051ba34a4af129158fb5e93 (diff) | |
parent | ed1565e18c86f1d9847a42c76951e82004cfddf0 (diff) | |
download | nextcloud-server-84b1253def9edb26d8643282cf4536e237a31a58.tar.gz nextcloud-server-84b1253def9edb26d8643282cf4536e237a31a58.zip |
Merge pull request #17208 from owncloud/stable7-fix-16812
[Stable7] Oracle workaround for adding a column with not-null default value
-rw-r--r-- | apps/files_trashbin/appinfo/preupdate.php | 21 |
1 files changed, 21 insertions, 0 deletions
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 @@ +<?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); + } + } +} |