20070915

propuesta de esquema de base de datos

Para el PMLibrary suguiero:

--
-- Table structure for table `editoriales`
--

DROP TABLE IF EXISTS `editorial`;
CREATE TABLE `editorial` (
`id` int(7) NOT NULL auto_increment,
`name` varchar(100) default NULL,
`contact` varchar(200) default NULL,
`email` varchar(200) default NULL,
PRIMARY KEY (`id`),
KEY `name` (`name`,`contact`)
);

--
-- Reviews
--

DROP TABLE IF EXISTS `reviews`;
CREATE TABLE `reviews` (
`id` int(7) NOT NULL auto_increment,
`object_id` int(7) NOT NULL default '0',
`review_title` varchar(100) NOT NULL default 'review title',
`review_text` text NOT NULL,
PRIMARY KEY (`id`),
KEY `review_title` (`review_title`),
FULLTEXT (`review_title`,`review_text`)
);

--
-- Table structure for table `media`
--

DROP TABLE IF EXISTS `objects`;
CREATE TABLE `objects` (
`id` int(7) NOT NULL auto_increment,
`title` varchar(100) default NULL,
`review` enum('s','n') default NULL,
`editorial_id` int(7) NOT NULL default '0',
`other_notes` TINYTEXT NULL,
PRIMARY KEY (`id`),
KEY `title` (`title`),
FULLTEXT (`title`,`other_notes`)
);


--
-- Table structure for table `withdraw`
--

DROP TABLE IF EXISTS `withdraw`;
CREATE TABLE `withdraw` (
`id` int(7) NOT NULL auto_increment,
`object_id` int(7) default NULL,
`user_id` int(7) default NULL,
`date_withdraw` date default NULL,
PRIMARY KEY (`id`)
);

--
-- Table structure for table `prestamos_historico`
--

DROP TABLE IF EXISTS `historical_rent`;
CREATE TABLE `historical_rent` (
`id` int(7) NOT NULL auto_increment,
`object_id` int(7) default NULL,
`user_id` int(7) default NULL,
`date_withdraw` date default NULL,
`date_deposit` date default NULL,
PRIMARY KEY (`id`)
);

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(7) NOT NULL auto_increment,
`name` varchar(100) default NULL,
`surname` varchar(100) default NULL,
`nick` varchar(100) default NULL,
`email` varchar(200) default NULL,
PRIMARY KEY (`id`),
KEY `Nombre` (`name`,`nick`)
);

No hay comentarios.: