From 7334df9929bb932e6ddc3bf6517c609812c17c1a Mon Sep 17 00:00:00 2001 From: roadiz-ci Date: Wed, 26 Jun 2024 16:00:10 +0000 Subject: [PATCH] Merge tag v2.3.15 into develop --- migrations/Version20240318204224.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/migrations/Version20240318204224.php b/migrations/Version20240318204224.php index 0897dc0b..1ac4f2f4 100644 --- a/migrations/Version20240318204224.php +++ b/migrations/Version20240318204224.php @@ -19,11 +19,16 @@ public function getDescription(): string public function up(Schema $schema): void { - $result = $this->connection->executeQuery('SELECT max(length(name)) FROM `node_type_fields`'); - $maxLength = $result->fetchOne(); + $result = $this->connection->executeQuery('SELECT count(id) FROM `node_type_fields`'); + $count = $result->fetchOne(); - $this->skipIf(!is_numeric($maxLength), 'Cannot find node_type_fields name maximum length.'); - $this->skipIf($maxLength >= 50, 'You have at least on node_type_field name that exceed 50 characters long.'); + if ($count > 0) { + $result = $this->connection->executeQuery('SELECT max(length(name)) FROM `node_type_fields`'); + $maxLength = $result->fetchOne(); + + $this->skipIf(!is_numeric($maxLength), 'Cannot find node_type_fields name maximum length.'); + $this->skipIf($maxLength >= 50, 'You have at least on node_type_field name that exceed 50 characters long.'); + } // this up() migration is auto-generated, please modify it to your needs $this->addSql('ALTER TABLE node_type_fields CHANGE name name VARCHAR(50) NOT NULL');