/*
Created		11/8/2006
Modified	11/8/2006
Project		RounCube
Model		Contacts
Company		
Author		Michel Moreira <drungrin@gmail.com>
Version		
Database	mySQL 5 
*/


Create table contacts (
	contact_id Int NOT NULL,
	changed Datetime,
	del Tinyint,
	name Varchar(128),
	email Varchar(128),
	firstname Varchar(128),
	user_id Int,
 Primary Key (contact_id)) ENGINE = MyISAM;

Create table contact_info_type (
	contact_info_type_id Int NOT NULL,
	display_label Varchar(128),
 Primary Key (contact_info_type_id)) ENGINE = MyISAM;

Create table contact_info (
	contact_id Int NOT NULL,
	contact_info_type_id Int NOT NULL,
	value Varchar(128),
	contact_info_id Int NOT NULL,
 Primary Key (contact_info_id)) ENGINE = MyISAM;

Alter table contact_info add Foreign Key (contact_id) references contacts (contact_id) on delete  restrict on update  restrict;
Alter table contact_info add Foreign Key (contact_info_type_id) references contact_info_type (contact_info_type_id) on delete  restrict on update  restrict;






