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

#-----------------------------------------------------------------------------
#-- node_sitemap
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `node_sitemap`;


CREATE TABLE `node_sitemap`
(
	`id` INTEGER  NOT NULL AUTO_INCREMENT,
	`node_id` INTEGER,
	PRIMARY KEY (`id`),
	INDEX `node_sitemap_FI_1` (`node_id`),
	CONSTRAINT `node_sitemap_FK_1`
		FOREIGN KEY (`node_id`)
		REFERENCES `node` (`id`)
		ON DELETE CASCADE
)Engine=InnoDB;

#-----------------------------------------------------------------------------
#-- node_sitemap_i18n
#-----------------------------------------------------------------------------

DROP TABLE IF EXISTS `node_sitemap_i18n`;


CREATE TABLE `node_sitemap_i18n`
(
	`id` INTEGER  NOT NULL,
	`culture` VARCHAR(7)  NOT NULL,
	PRIMARY KEY (`id`,`culture`),
	KEY `node_sitemap_i18n_I_1`(`culture`),
	CONSTRAINT `node_sitemap_i18n_FK_1`
		FOREIGN KEY (`id`)
		REFERENCES `node_sitemap` (`id`)
		ON DELETE CASCADE
)Engine=InnoDB;

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