I have two pieces of data: 1) User and 2) Portfolio. Each user has only one portfolio. At the registration process user has to fill out the following fields:
- First name
- Last name
- Porfolio title
- Portfolio url
- Password
My DB structure at the moment looks like this:
CREATE TABLE `User` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(80) NOT NULL,
`password` varchar(128) NOT NULL,
`firstName` varchar(30) NOT NULL,
`lastName` varchar(30) NOT NULL,
`ip` varchar(15) NOT NULL,
`lastVisit` int(10) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '2',
`created` int(10) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
UNIQUE KEY `email_UNIQUE` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
CREATE TABLE `Portfolio` (
`userId` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`url` varchar(45) NOT NULL,
`theme` tinyint(2) NOT NULL DEFAULT '1',
`font` tinyint(2) NOT NULL DEFAULT '1',
`footer` varchar(255) NOT NULL,
`isFeatured` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`userId`),
UNIQUE KEY `id_UNIQUE` (`userId`),
UNIQUE KEY `url_UNIQUE` (`url`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
But now looking at the database I think there is no reason to have two separate tables. The other thing is I don't really want to mix user fields and portfolio fields.
What would you do in this case?
Any suggestions are greatly appreciated.
Thank you!