From 7f68c60009b3459fb0b1a621fc5720c6b2d100d2 Mon Sep 17 00:00:00 2001 From: Junior Date: Mon, 23 Nov 2026 18:29:42 -0500 Subject: [PATCH] Tad bit of standards compliance in the default sql. Make the title not exceed 255 chars. --- class_task.php | 1 + install/hometasks.sql | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/class_task.php b/class_task.php index d1577b5..52380e9 100644 --- a/class_task.php +++ b/class_task.php @@ -89,6 +89,7 @@ class Task implements JsonSerializable { if ( is_null($title) ) return false; if ( !is_string($title) ) return false; $title = trim($title); + if ( strlen($title) > 255 ) $title = substr($title, 0, 255); if ( $title == "" ) return false; settype($title, "string"); $this->title = $title; diff --git a/install/hometasks.sql b/install/hometasks.sql index 8414192..1889e5d 100644 --- a/install/hometasks.sql +++ b/install/hometasks.sql @@ -23,15 +23,15 @@ DROP TABLE IF EXISTS `tasks`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `tasks` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `id` int unsigned NOT NULL AUTO_INCREMENT, `title` varchar(255) NOT NULL DEFAULT '', - `description` text NOT NULL DEFAULT '', - `priority` tinyint(3) unsigned NOT NULL DEFAULT 5, + `description` text NOT NULL DEFAULT (''), + `priority` tinyint unsigned NOT NULL DEFAULT 5, `createtime` datetime NOT NULL, `duetime` datetime NOT NULL, `completetime` datetime DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC; /*!40101 SET character_set_client = @saved_cs_client */; --