FEATURE: add custom field resource and possible values to schema
This commit is contained in:
+20
-25
@@ -1,5 +1,5 @@
|
|||||||
-- MySQL Script generated by MySQL Workbench
|
-- MySQL Script generated by MySQL Workbench
|
||||||
-- Út 26. leden 2016, 21:53:01 CET
|
-- Út 26. leden 2016, 22:44:34 CET
|
||||||
-- Model: New Model Version: 1.0
|
-- Model: New Model Version: 1.0
|
||||||
-- MySQL Workbench Forward Engineering
|
-- MySQL Workbench Forward Engineering
|
||||||
|
|
||||||
@@ -233,6 +233,16 @@ ENGINE = InnoDB
|
|||||||
COMMENT = 'List of all custom field types.';
|
COMMENT = 'List of all custom field types.';
|
||||||
|
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `custom_field_resource`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `custom_field_resource` (
|
||||||
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` VARCHAR(64) NOT NULL COMMENT 'Name of resource for custom fields. Saved as translation string.',
|
||||||
|
PRIMARY KEY (`id`))
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `custom_fields`
|
-- Table `custom_fields`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
@@ -240,19 +250,27 @@ CREATE TABLE IF NOT EXISTS `custom_fields` (
|
|||||||
`id` INT NOT NULL AUTO_INCREMENT,
|
`id` INT NOT NULL AUTO_INCREMENT,
|
||||||
`name` VARCHAR(128) NOT NULL,
|
`name` VARCHAR(128) NOT NULL,
|
||||||
`type_id` INT NOT NULL COMMENT 'Foreign key to custom_field_types table',
|
`type_id` INT NOT NULL COMMENT 'Foreign key to custom_field_types table',
|
||||||
|
`resource_id` INT NOT NULL,
|
||||||
`description` MEDIUMTEXT NULL DEFAULT NULL COMMENT 'Description used for detailed information about meaning of given custom field',
|
`description` MEDIUMTEXT NULL DEFAULT NULL COMMENT 'Description used for detailed information about meaning of given custom field',
|
||||||
`default_value` TEXT NULL DEFAULT NULL,
|
`default_value` TEXT NULL DEFAULT NULL,
|
||||||
|
`possible_values` TEXT NULL DEFAULT NULL COMMENT 'Possible values separated with pipeline',
|
||||||
`regexp` MEDIUMTEXT NULL DEFAULT NULL,
|
`regexp` MEDIUMTEXT NULL DEFAULT NULL,
|
||||||
`min_length` INT(11) NULL DEFAULT NULL,
|
`min_length` INT(11) NULL DEFAULT NULL,
|
||||||
`max_length` INT(11) NULL DEFAULT NULL,
|
`max_length` INT(11) NULL DEFAULT NULL,
|
||||||
`required` TINYINT(1) NOT NULL DEFAULT 0,
|
`required` TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
INDEX `fk_custom_fields_custom_field_types1_idx` (`type_id` ASC),
|
INDEX `fk_custom_fields_custom_field_types1_idx` (`type_id` ASC),
|
||||||
|
INDEX `fk_custom_fields_custom_field_resource1_idx` (`resource_id` ASC),
|
||||||
CONSTRAINT `fk_custom_fields_custom_field_types1`
|
CONSTRAINT `fk_custom_fields_custom_field_types1`
|
||||||
FOREIGN KEY (`type_id`)
|
FOREIGN KEY (`type_id`)
|
||||||
REFERENCES `custom_field_types` (`id`)
|
REFERENCES `custom_field_types` (`id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE)
|
ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `fk_custom_fields_custom_field_resource1`
|
||||||
|
FOREIGN KEY (`resource_id`)
|
||||||
|
REFERENCES `custom_field_resource` (`id`)
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION)
|
||||||
ENGINE = InnoDB
|
ENGINE = InnoDB
|
||||||
COMMENT = 'List of all custom fields which may be used for extending some part of content on webpage';
|
COMMENT = 'List of all custom fields which may be used for extending some part of content on webpage';
|
||||||
|
|
||||||
@@ -280,29 +298,6 @@ CREATE TABLE IF NOT EXISTS `user_has_custom_field` (
|
|||||||
ENGINE = InnoDB;
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
|
||||||
-- Table `module_has_custom_field`
|
|
||||||
-- -----------------------------------------------------
|
|
||||||
CREATE TABLE IF NOT EXISTS `module_has_custom_field` (
|
|
||||||
`module_handler` VARCHAR(255) NOT NULL,
|
|
||||||
`custom_field_id` INT NOT NULL,
|
|
||||||
PRIMARY KEY (`module_handler`, `custom_field_id`),
|
|
||||||
INDEX `fk_module_has_custom_field_custom_field1_idx` (`custom_field_id` ASC),
|
|
||||||
INDEX `fk_module_has_custom_field_module1_idx` (`module_handler` ASC),
|
|
||||||
CONSTRAINT `fk_module_has_custom_field_module1`
|
|
||||||
FOREIGN KEY (`module_handler`)
|
|
||||||
REFERENCES `modules` (`handler`)
|
|
||||||
ON DELETE CASCADE
|
|
||||||
ON UPDATE CASCADE,
|
|
||||||
CONSTRAINT `fk_module_has_custom_field_custom_field1`
|
|
||||||
FOREIGN KEY (`custom_field_id`)
|
|
||||||
REFERENCES `custom_fields` (`id`)
|
|
||||||
ON DELETE NO ACTION
|
|
||||||
ON UPDATE NO ACTION)
|
|
||||||
ENGINE = InnoDB
|
|
||||||
COMMENT = 'Table used for assigning different custom fields to different modules. This table does not hold information about any configuration nor values of custom fields. Value is stored in content_has_custom_fields table.';
|
|
||||||
|
|
||||||
|
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
-- Table `action_log_types`
|
-- Table `action_log_types`
|
||||||
-- -----------------------------------------------------
|
-- -----------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user