#-----------------------------------------------------------------------------
#-- video
#-----------------------------------------------------------------------------

CREATE TABLE `video`
(
	`id` INTEGER  NOT NULL AUTO_INCREMENT,
	`hierarchy_id` INTEGER  NOT NULL,
	`available` INTEGER default 0 NOT NULL,
	`start` DATE,
	`end` DATE,
	PRIMARY KEY (`id`),
	KEY `video_FI_1`(`hierarchy_id`),
	CONSTRAINT `video_FK_1`
		FOREIGN KEY (`hierarchy_id`)
		REFERENCES `hierarchy` (`id`)
		ON UPDATE RESTRICT
		ON DELETE RESTRICT
);

#-----------------------------------------------------------------------------
#-- video_i18n
#-----------------------------------------------------------------------------

CREATE TABLE `video_i18n`
(
	`id` INTEGER  NOT NULL,
	`culture` VARCHAR(7)  NOT NULL,
	`name` VARCHAR(256)  NOT NULL,
	`description` TEXT,
	`filename` VARCHAR(2048),
	`filesize` INTEGER,
	`file_format` VARCHAR(255),
	`checksum` VARCHAR(40)  NOT NULL,
	`preview_filename` VARCHAR(2048),
	`preview_format` VARCHAR(32),
	`preview_checksum` VARCHAR(40),
	`created_at` DATETIME,
	`updated_at` DATETIME,
	PRIMARY KEY (`id`,`culture`),
	CONSTRAINT `video_i18n_FK_1`
		FOREIGN KEY (`id`)
		REFERENCES `video` (`id`)
		ON UPDATE RESTRICT
		ON DELETE CASCADE
);
