Table shouldn't use CHAR(1) to store active, working, and private fields

drewish - February 21, 2006 - 04:45
Project:Filemanager
Version:HEAD
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

I've run into some serious wierdness with the table due to the active, working and private fields being stored as a CHAR(1) rather than TINYINT(1). Here's a patch to treat them differently and the (My)SQL needed to update the tables.

UPDATE file SET `active`= 1 WHERE `active`LIKE 't';
UPDATE file SET `active`= 0 WHERE `active`!= 1;
UPDATE file SET `working`= 1 WHERE `working`LIKE 't';
UPDATE file SET `working`= 0 WHERE `working`!= 1;
UPDATE file SET `private`= 1 WHERE `private`LIKE 't';
UPDATE file SET `private`= 0 WHERE `private`!= 1;

ALTER TABLE file MODIFY COLUMN `active` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
MODIFY COLUMN `working` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
MODIFY COLUMN `private` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0;
}

AttachmentSize
filemanager.module_boolean_fields.patch3.61 KB

#1

drewish - February 21, 2006 - 04:45
Priority:normal» critical
 
 

Drupal is a registered trademark of Dries Buytaert.