Re: business users services
Rick James Wrote:
-------------------------------------------------------
> Instead of INT SIGNED, consider MEDIUMINT UNSIGNED
> or SMALLINT UNSIGNED.
That is not bad idea but I need to add here regarding the b_user.That column references a b_users table:
CREATE TABLE `business_users` (
`crID` int(11) NOT NULL,
`address` varchar(90) DEFAULT NULL,
`url` varchar(90) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
`city` varchar(100) DEFAULT NULL,
`municipality` varchar(100) DEFAULT NULL,
`bus_user_type` enum('1','2','3','4','5') CHARACTER SET latin1 DEFAULT NULL,
PRIMARY KEY (`crID`),
KEY `fk_business_users_buz_usertype1_idx` (`bus_user_type`),
KEY `crID` (`crID`),
CONSTRAINT `fk_business_users_buz_usertype1` FOREIGN KEY (`bus_user_type`) REFERENCES `buz_usertype` (`Type_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_business_users_users1` FOREIGN KEY (`crID`) REFERENCES `users` (`user_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8
And the crID column of the above table references users(`user_ID`)...here is the users table:
CREATE TABLE `users` (
`user_ID` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`lastname` varchar(45) NOT NULL,
`email` varchar(255) DEFAULT NULL,
`password` varchar(100) DEFAULT NULL,
`hash` varchar(32) DEFAULT NULL,
`usertype` enum('regular_user','buz_user','superadmin','reg_buz_user','deleted') DEFAULT NULL,
`Reg_date_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`user_ID`),
KEY `fk_users_usertype1_idx` (`usertype`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8
So,changing the data type for b_users means changing it also for the user_id...given the fact that the users table contains all the users of the site(business users and regular users),which means a bigger INT is required,do you still think is a good idea to use MEDIUMINT or SMALLINT?
P.S As I saw in the manual MEDIUMINT UNSIGNED can go all the way till 16+ million ...which I think is enough...but I would like your comment anyway on the above.