use proactiveenglish;
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;

#-----------------------------------------------------------------------------
#-- Employee
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `Employee`;


CREATE TABLE `Employee`
(
	`id` INTEGER  NOT NULL AUTO_INCREMENT,
	`name` VARCHAR(100),
	`degrees` VARCHAR(255),
	`phone` VARCHAR(25),
	`cellphone` VARCHAR(25),
	`email` VARCHAR(100),
	`picture` VARCHAR(100),
	`active` INTEGER,
	`position` INTEGER,
	`slug` VARCHAR(100),
	`sort_order` INTEGER,
	PRIMARY KEY (`id`),
	INDEX `Employee_FI_1` (`position`),
	CONSTRAINT `Employee_FK_1`
		FOREIGN KEY (`position`)
		REFERENCES `LU_Employee_Position` (`id`)
)Type=MyISAM;

#-----------------------------------------------------------------------------
#-- Employee_i18n
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `Employee_i18n`;


CREATE TABLE `Employee_i18n`
(
	`biography` TEXT,
	`title` VARCHAR(100),
	`id` INTEGER  NOT NULL,
	`culture` VARCHAR(7)  NOT NULL,
	PRIMARY KEY (`id`,`culture`),
	CONSTRAINT `Employee_i18n_FK_1`
		FOREIGN KEY (`id`)
		REFERENCES `Employee` (`id`)
		ON DELETE CASCADE
)Type=MyISAM;

#-----------------------------------------------------------------------------
#-- Event
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `Event`;


CREATE TABLE `Event`
(
	`id` INTEGER  NOT NULL AUTO_INCREMENT,
	`picture` VARCHAR(255),
	`expires_on` DATETIME,
	PRIMARY KEY (`id`)
)Type=MyISAM;

#-----------------------------------------------------------------------------
#-- Event_i18n
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `Event_i18n`;


CREATE TABLE `Event_i18n`
(
	`title` VARCHAR(255),
	`description` TEXT,
	`id` INTEGER  NOT NULL,
	`culture` VARCHAR(7)  NOT NULL,
	PRIMARY KEY (`id`,`culture`),
	CONSTRAINT `Event_i18n_FK_1`
		FOREIGN KEY (`id`)
		REFERENCES `Event` (`id`)
		ON DELETE CASCADE
)Type=MyISAM;

#-----------------------------------------------------------------------------
#-- Course
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `Course`;


CREATE TABLE `Course`
(
	`id` INTEGER  NOT NULL AUTO_INCREMENT,
	`slug` VARCHAR(100),
	PRIMARY KEY (`id`)
)Type=MyISAM;

#-----------------------------------------------------------------------------
#-- Course_i18n
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `Course_i18n`;


CREATE TABLE `Course_i18n`
(
	`title` VARCHAR(255),
	`description` TEXT,
	`id` INTEGER  NOT NULL,
	`culture` VARCHAR(7)  NOT NULL,
	PRIMARY KEY (`id`,`culture`),
	CONSTRAINT `Course_i18n_FK_1`
		FOREIGN KEY (`id`)
		REFERENCES `Course` (`id`)
		ON DELETE CASCADE
)Type=MyISAM;

#-----------------------------------------------------------------------------
#-- Reference
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `Reference`;


CREATE TABLE `Reference`
(
	`id` INTEGER  NOT NULL AUTO_INCREMENT,
	`company_name` VARCHAR(255),
	PRIMARY KEY (`id`)
)Type=MyISAM;

#-----------------------------------------------------------------------------
#-- LU_Employee_Position
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `LU_Employee_Position`;


CREATE TABLE `LU_Employee_Position`
(
	`id` INTEGER  NOT NULL AUTO_INCREMENT,
	`position` VARCHAR(25),
	PRIMARY KEY (`id`)
)Type=MyISAM;

# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
