From 8c322e253f67e4c970e6eedec52e551a4ca069d2 Mon Sep 17 00:00:00 2001 From: sualko Date: Thu, 28 Jul 2022 21:42:48 +0200 Subject: [PATCH] fix: convert boolean columns to not nullable --- .../Version000000Date20220728083700.php | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lib/Migration/Version000000Date20220728083700.php diff --git a/lib/Migration/Version000000Date20220728083700.php b/lib/Migration/Version000000Date20220728083700.php new file mode 100644 index 0000000..3b8858f --- /dev/null +++ b/lib/Migration/Version000000Date20220728083700.php @@ -0,0 +1,49 @@ +convertToNotNullable($schema, 'bbb_rooms', 'record'); + $this->convertToNotNullable($schema, 'bbb_rooms', 'everyone_is_moderator'); + $this->convertToNotNullable($schema, 'bbb_rooms', 'require_moderator'); + $this->convertToNotNullable($schema, 'bbb_rooms', 'listen_only'); + $this->convertToNotNullable($schema, 'bbb_rooms', 'media_check'); + $this->convertToNotNullable($schema, 'bbb_rooms', 'clean_layout'); + + $this->convertToNotNullable($schema, 'bbb_restrictions', 'allow_recording'); + + return null; + } + + private function convertToNotNullable(ISchemaWrapper $schema, string $table, string $column): void { + if ($schema->hasTable($table)) { + $table = $schema->getTable('bbb_rooms'); + + if ($table->hasColumn($column) && $table->getColumn($column)->getNotnull()) { + $table->getColumn($column)->setNotnull(false); + } + } + } +}