From 0befe071275c8f0f7599a883862884684e19b43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 9 Dec 2020 12:13:02 +0100 Subject: [PATCH] Change further columns to be nullable with a default of 0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .../Version13000Date20170718121200.php | 14 ++++--------- .../Version13000Date20170919121250.php | 2 +- .../Version21000Date20201120141228.php | 20 +++++++++++++++++++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index ffd230e19a..3acdc3122e 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -518,12 +518,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')) { @@ -576,25 +570,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, diff --git a/core/Migrations/Version13000Date20170919121250.php b/core/Migrations/Version13000Date20170919121250.php index 284a509f5a..0667ea8733 100644 --- a/core/Migrations/Version13000Date20170919121250.php +++ b/core/Migrations/Version13000Date20170919121250.php @@ -68,7 +68,7 @@ class Version13000Date20170919121250 extends SimpleMigrationStep { $column->setUnsigned(true); } else { $table->addColumn('remember', 'smallint', [ - 'notnull' => true, + 'notnull' => false, 'length' => 1, 'default' => 0, 'unsigned' => true, diff --git a/core/Migrations/Version21000Date20201120141228.php b/core/Migrations/Version21000Date20201120141228.php index 48c924977d..844679b8d9 100644 --- a/core/Migrations/Version21000Date20201120141228.php +++ b/core/Migrations/Version21000Date20201120141228.php @@ -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; } }