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

DROP TABLE IF EXISTS `media_youtube`;


CREATE TABLE `media_youtube`
(
	`mid` INTEGER(11)  NOT NULL,
	`youtube` VARCHAR(1024)  NOT NULL,
	`id` VARCHAR(255)  NOT NULL,
	`title` VARCHAR(255),
	`description` TEXT,
	`keywords` TEXT,
	`thumbnail` VARCHAR(1024),
	`url` VARCHAR(1024),
	`duration` INTEGER(11),
	`owner` VARCHAR(255),
	`related` TINYINT(1) default 0 NOT NULL,
	`created_at` DATETIME  NOT NULL,
	`updated_at` DATETIME  NOT NULL,
	PRIMARY KEY (`mid`),
	KEY `my_i_id`(`id`),
	CONSTRAINT `my_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;
