
# 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;

#-----------------------------------------------------------------------------
#-- media_chapter
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `media_chapter`;


CREATE TABLE `media_chapter`
(
	`id` INTEGER(11)  NOT NULL AUTO_INCREMENT,
	`mid` INTEGER(11)  NOT NULL,
	`language` VARCHAR(128)  NOT NULL,
	`title` VARCHAR(128)  NOT NULL,
	`time` INTEGER(11)  NOT NULL,
	`description` TEXT,
	`created_at` DATETIME  NOT NULL,
	`updated_at` DATETIME  NOT NULL,
	PRIMARY KEY (`id`),
	KEY `mch_i_id`(`id`),
	INDEX `FI__fk_mid` (`mid`),
	CONSTRAINT `mch_fk_mid`
		FOREIGN KEY (`mid`)
		REFERENCES `media` (`mid`)
)Engine=InnoDB;

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