Files
aux-bieaux-legumes/local/modules/PointRetrait/Config/thelia.sql

53 lines
1.6 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;
-- ---------------------------------------------------------------------
-- pdr_places
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `pdr_places`;
CREATE TABLE `pdr_places`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`title` VARCHAR(50) NOT NULL,
`active` TINYINT DEFAULT 1 NOT NULL,
`price` FLOAT DEFAULT 0 NOT NULL,
`minimum_amount` FLOAT DEFAULT 0 NOT NULL,
`latitude` DOUBLE,
`longitude` DOUBLE,
`address1` VARCHAR(100) NOT NULL,
`address2` VARCHAR(100),
`zipcode` VARCHAR(10) NOT NULL,
`city` VARCHAR(100) NOT NULL,
`access_comment` VARCHAR(400),
`click_and_collect` TINYINT DEFAULT 0 NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ---------------------------------------------------------------------
-- pdr_schedule
-- ---------------------------------------------------------------------
DROP TABLE IF EXISTS `pdr_schedule`;
CREATE TABLE `pdr_schedule`
(
`id` INTEGER NOT NULL AUTO_INCREMENT,
`id_place` INTEGER NOT NULL,
`day` INTEGER NOT NULL,
`begin_time` TIME NOT NULL,
`end_time` TIME NOT NULL,
PRIMARY KEY (`id`),
INDEX `fi_places_schedule` (`id_place`),
CONSTRAINT `fk_places_schedule`
FOREIGN KEY (`id_place`)
REFERENCES `pdr_places` (`id`)
ON DELETE CASCADE
) ENGINE=InnoDB;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;