Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-11-09 12:38:47 +0300
committerJoas Schilling <coding@schilljs.com>2020-11-12 14:57:51 +0300
commit8ff0523c3d5a657da90a980ba4f96fc72321104a (patch)
tree08c74b466a634f45060fdccd2b7f36ce7400f09b /core
parentfcef3c0e8a03021591162fb16be84c024c689111 (diff)
Make sure columns with an empty default are nullable for Oracle
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core')
-rw-r--r--core/Migrations/Version13000Date20170718121200.php2
-rw-r--r--core/Migrations/Version14000Date20180710092004.php1
-rw-r--r--core/Migrations/Version15000Date20180926101451.php4
-rw-r--r--core/Migrations/Version15000Date20181015062942.php2
-rw-r--r--core/Migrations/Version16000Date20190207141427.php2
-rw-r--r--core/Migrations/Version16000Date20190428150708.php2
-rw-r--r--core/Migrations/Version20000Date20201109081915.php64
7 files changed, 71 insertions, 6 deletions
diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php
index f3129c22ca2..fcea6657b30 100644
--- a/core/Migrations/Version13000Date20170718121200.php
+++ b/core/Migrations/Version13000Date20170718121200.php
@@ -813,7 +813,7 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
if (!$schema->hasTable('credentials')) {
$table = $schema->createTable('credentials');
$table->addColumn('user', 'string', [
- 'notnull' => true,
+ 'notnull' => false,
'length' => 64,
]);
$table->addColumn('identifier', 'string', [
diff --git a/core/Migrations/Version14000Date20180710092004.php b/core/Migrations/Version14000Date20180710092004.php
index 141b0c1afb5..767d8ee5f7d 100644
--- a/core/Migrations/Version14000Date20180710092004.php
+++ b/core/Migrations/Version14000Date20180710092004.php
@@ -43,6 +43,7 @@ class Version14000Date20180710092004 extends SimpleMigrationStep {
if (!$table->hasColumn('password_by_talk')) {
$table->addColumn('password_by_talk', Types::BOOLEAN, [
'default' => 0,
+ 'notnull' => false,
]);
}
diff --git a/core/Migrations/Version15000Date20180926101451.php b/core/Migrations/Version15000Date20180926101451.php
index a5f37cc9125..e03a11318c0 100644
--- a/core/Migrations/Version15000Date20180926101451.php
+++ b/core/Migrations/Version15000Date20180926101451.php
@@ -45,8 +45,8 @@ class Version15000Date20180926101451 extends SimpleMigrationStep {
$table = $schema->getTable('authtoken');
$table->addColumn('password_invalid','boolean', [
- 'notnull' => true,
- 'default' => false,
+ 'default' => 0,
+ 'notnull' => false,
]);
return $schema;
diff --git a/core/Migrations/Version15000Date20181015062942.php b/core/Migrations/Version15000Date20181015062942.php
index eaeaf0dd268..23c2a904741 100644
--- a/core/Migrations/Version15000Date20181015062942.php
+++ b/core/Migrations/Version15000Date20181015062942.php
@@ -45,7 +45,7 @@ class Version15000Date20181015062942 extends SimpleMigrationStep {
$table = $schema->getTable('share');
$table->addColumn('hide_download', 'smallint', [
- 'notnull' => true,
+ 'notnull' => false,
'length' => 1,
'default' => 0,
]);
diff --git a/core/Migrations/Version16000Date20190207141427.php b/core/Migrations/Version16000Date20190207141427.php
index e6235efe201..63c6c871eae 100644
--- a/core/Migrations/Version16000Date20190207141427.php
+++ b/core/Migrations/Version16000Date20190207141427.php
@@ -102,7 +102,7 @@ class Version16000Date20190207141427 extends SimpleMigrationStep {
'default' => '',
]);
$table->addColumn('access', Types::SMALLINT, [
- 'notnull' => true,
+ 'notnull' => false,
'default' => 0,
]);
diff --git a/core/Migrations/Version16000Date20190428150708.php b/core/Migrations/Version16000Date20190428150708.php
index 546d4c19e14..dc33b08035a 100644
--- a/core/Migrations/Version16000Date20190428150708.php
+++ b/core/Migrations/Version16000Date20190428150708.php
@@ -49,7 +49,7 @@ class Version16000Date20190428150708 extends SimpleMigrationStep {
if ($schema->hasTable('collres_accesscache')) {
$table = $schema->getTable('collres_accesscache');
$table->addColumn('access', Types::BOOLEAN, [
- 'notnull' => true,
+ 'notnull' => false,
'default' => false
]);
}
diff --git a/core/Migrations/Version20000Date20201109081915.php b/core/Migrations/Version20000Date20201109081915.php
new file mode 100644
index 00000000000..720f54d8e8b
--- /dev/null
+++ b/core/Migrations/Version20000Date20201109081915.php
@@ -0,0 +1,64 @@
+<?php
+declare(strict_types=1);
+
+/**
+ * @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
+ *
+ * @author Joas Schilling <coding@schilljs.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OC\Core\Migrations;
+
+use Closure;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+class Version20000Date20201109081915 extends SimpleMigrationStep {
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ * @return null|ISchemaWrapper
+ */
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ $result = $this->ensureColumnIsNullable($schema, 'share', 'password_by_talk');
+ $result = $this->ensureColumnIsNullable($schema, 'share', 'hide_download') || $result;
+ $result = $this->ensureColumnIsNullable($schema, 'credentials', 'user') || $result;
+ $result = $this->ensureColumnIsNullable($schema, 'authtoken', 'password_invalid') || $result;
+ $result = $this->ensureColumnIsNullable($schema, 'collres_accesscache', 'access') || $result;
+
+ return $result ? $schema : null;
+ }
+
+ protected function ensureColumnIsNullable(ISchemaWrapper $schema, string $tableName, string $columnName): bool {
+ $table = $schema->getTable($tableName);
+ $column = $table->getColumn($columnName);
+
+ if ($column->getNotnull()) {
+ $column->setNotnull(false);
+ return true;
+ }
+
+ return false;
+ }
+}