60 lines
1.9 KiB
SQL
60 lines
1.9 KiB
SQL
|
|
# 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;
|
|
|
|
-- ---------------------------------------------------------------------
|
|
-- agenda_content_date
|
|
-- ---------------------------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `agenda_content_date`;
|
|
|
|
CREATE TABLE `agenda_content_date`
|
|
(
|
|
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
|
`date_debut` DATE NOT NULL,
|
|
`date_fin` DATE NOT NULL,
|
|
`heure` VARCHAR(255) NOT NULL,
|
|
`content_id` INTEGER NOT NULL,
|
|
`created_at` DATETIME,
|
|
`updated_at` DATETIME,
|
|
PRIMARY KEY (`id`),
|
|
INDEX `agenda_content_date_fi_071afa` (`content_id`),
|
|
CONSTRAINT `agenda_content_date_fk_071afa`
|
|
FOREIGN KEY (`content_id`)
|
|
REFERENCES `content` (`id`)
|
|
ON UPDATE RESTRICT
|
|
ON DELETE CASCADE
|
|
) ENGINE=InnoDB;
|
|
|
|
-- ---------------------------------------------------------------------
|
|
-- agenda_related_product
|
|
-- ---------------------------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `agenda_related_product`;
|
|
|
|
CREATE TABLE `agenda_related_product`
|
|
(
|
|
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
|
`content_id` INTEGER NOT NULL,
|
|
`product_id` INTEGER NOT NULL,
|
|
`created_at` DATETIME,
|
|
`updated_at` DATETIME,
|
|
PRIMARY KEY (`id`),
|
|
INDEX `agenda_related_product_fi_071afa` (`content_id`),
|
|
INDEX `agenda_related_product_fi_0f5ed8` (`product_id`),
|
|
CONSTRAINT `agenda_related_product_fk_071afa`
|
|
FOREIGN KEY (`content_id`)
|
|
REFERENCES `content` (`id`)
|
|
ON UPDATE RESTRICT
|
|
ON DELETE CASCADE,
|
|
CONSTRAINT `agenda_related_product_fk_0f5ed8`
|
|
FOREIGN KEY (`product_id`)
|
|
REFERENCES `product` (`id`)
|
|
ON UPDATE RESTRICT
|
|
ON DELETE CASCADE
|
|
) ENGINE=InnoDB;
|
|
|
|
# This restores the fkey checks, after having unset them earlier
|
|
SET FOREIGN_KEY_CHECKS = 1;
|