]> source.dussan.org Git - nextcloud-server.git/commitdiff
Change further columns to be nullable with a default of 0
authorJulius Härtl <jus@bitgrid.net>
Wed, 9 Dec 2020 11:13:02 +0000 (12:13 +0100)
committerJulius Härtl <jus@bitgrid.net>
Mon, 14 Dec 2020 10:12:52 +0000 (11:12 +0100)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
core/Migrations/Version13000Date20170718121200.php
core/Migrations/Version13000Date20170919121250.php
core/Migrations/Version21000Date20201120141228.php

index 09fec43b69a1ccde7b3fdd08492b2a0cfc6a24c7..253c6654dd685c2b17000ee35c5ed225f20f6086 100644 (file)
@@ -509,12 +509,6 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
                        ]);
                        $table->setPrimaryKey(['id']);
                        $table->addIndex(['class'], 'job_class_index');
-               } else {
-                       $table = $schema->getTable('jobs');
-                       $table->changeColumn('execution_duration', [
-                               'notnull' => true,
-                               'default' => 0,
-                       ]);
                }
 
                if (!$schema->hasTable('users')) {
@@ -567,25 +561,25 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
                                'default' => '',
                        ]);
                        $table->addColumn('type', 'smallint', [
-                               'notnull' => true,
+                               'notnull' => false,
                                'length' => 2,
                                'default' => 0,
                                'unsigned' => true,
                        ]);
                        $table->addColumn('remember', 'smallint', [
-                               'notnull' => true,
+                               'notnull' => false,
                                'length' => 1,
                                'default' => 0,
                                'unsigned' => true,
                        ]);
                        $table->addColumn('last_activity', 'integer', [
-                               'notnull' => true,
+                               'notnull' => false,
                                'length' => 4,
                                'default' => 0,
                                'unsigned' => true,
                        ]);
                        $table->addColumn('last_check', 'integer', [
-                               'notnull' => true,
+                               'notnull' => false,
                                'length' => 4,
                                'default' => 0,
                                'unsigned' => true,
index 330a0141eb864ced3e9acc9292dca1e1393469d8..0667ea873396470301952e1a653a6802eb32c99e 100644 (file)
@@ -63,8 +63,17 @@ class Version13000Date20170919121250 extends SimpleMigrationStep {
                $column->setUnsigned(true);
                $column = $table->getColumn('type');
                $column->setUnsigned(true);
-               $column = $table->getColumn('remember');
-               $column->setUnsigned(true);
+               if ($table->hasColumn('remember')) {
+                       $column = $table->getColumn('remember');
+                       $column->setUnsigned(true);
+               } else {
+                       $table->addColumn('remember', 'smallint', [
+                               'notnull' => false,
+                               'length' => 1,
+                               'default' => 0,
+                               'unsigned' => true,
+                       ]);
+               }
                $column = $table->getColumn('last_activity');
                $column->setUnsigned(true);
                $column = $table->getColumn('last_check');
index 48c924977d0419502e32263d39af77ebda9a4254..844679b8d95c465bc1f275ff5889463831b5e344 100644 (file)
@@ -20,6 +20,18 @@ class Version21000Date20201120141228 extends SimpleMigrationStep {
                        if ($loginNameColumn->getLength() !== 255) {
                                $loginNameColumn->setLength(255);
                        }
+                       $table->changeColumn('type', [
+                               'notnull' => false,
+                       ]);
+                       $table->changeColumn('remember', [
+                               'notnull' => false,
+                       ]);
+                       $table->changeColumn('last_activity', [
+                               'notnull' => false,
+                       ]);
+                       $table->changeColumn('last_check', [
+                               'notnull' => false,
+                       ]);
                }
 
                if ($schema->hasTable('dav_job_status')) {
@@ -40,6 +52,14 @@ class Version21000Date20201120141228 extends SimpleMigrationStep {
                        }
                }
 
+               if ($schema->hasTable('jobs')) {
+                       $table = $schema->getTable('jobs');
+                       $table->changeColumn('execution_duration', [
+                               'notnull' => false,
+                               'default' => 0,
+                       ]);
+               }
+
                return $schema;
        }
 }