Tad bit of standards compliance in the default sql. Make the title not exceed 255 chars.

This commit is contained in:
Junior 2026-11-23 18:29:42 -05:00
parent df205e6393
commit 7f68c60009
2 changed files with 5 additions and 4 deletions

View File

@ -89,6 +89,7 @@ class Task implements JsonSerializable {
if ( is_null($title) ) return false; if ( is_null($title) ) return false;
if ( !is_string($title) ) return false; if ( !is_string($title) ) return false;
$title = trim($title); $title = trim($title);
if ( strlen($title) > 255 ) $title = substr($title, 0, 255);
if ( $title == "" ) return false; if ( $title == "" ) return false;
settype($title, "string"); settype($title, "string");
$this->title = $title; $this->title = $title;

View File

@ -23,15 +23,15 @@ DROP TABLE IF EXISTS `tasks`;
/*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */; /*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tasks` ( CREATE TABLE `tasks` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `id` int unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL DEFAULT '', `title` varchar(255) NOT NULL DEFAULT '',
`description` text NOT NULL DEFAULT '', `description` text NOT NULL DEFAULT (''),
`priority` tinyint(3) unsigned NOT NULL DEFAULT 5, `priority` tinyint unsigned NOT NULL DEFAULT 5,
`createtime` datetime NOT NULL, `createtime` datetime NOT NULL,
`duetime` datetime NOT NULL, `duetime` datetime NOT NULL,
`completetime` datetime DEFAULT NULL, `completetime` datetime DEFAULT NULL,
PRIMARY KEY (`id`) 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 */; /*!40101 SET character_set_client = @saved_cs_client */;
-- --