Commit 607a5bd8 authored by Carsten  Rose's avatar Carsten Rose
Browse files

formEditor.sql: started to enhance table Form and FormElement for real world.

parent 4a4041e4
DROP TABLE IF EXISTS `Form`;
CREATE TABLE IF NOT EXISTS `Form` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL DEFAULT '',
`title` VARCHAR(255) NOT NULL DEFAULT '',
`noteInternal` TEXT NOT NULL,
`tableName` VARCHAR(255) NOT NULL DEFAULT '',
`permitNew` ENUM('sip', 'logged_in', 'logged_out', 'always', 'never') NOT NULL DEFAULT 'sip',
`permitEdit` ENUM('sip', 'logged_in', 'logged_out', 'always', 'never') NOT NULL DEFAULT 'sip',
`permitUrlParameter` VARCHAR(255) NOT NULL DEFAULT '',
`render` ENUM('Plain', 'Bootstrap') NOT NULL DEFAULT 'Plain',
`multiMode` ENUM('none', 'horizontal', 'vertical') NOT NULL DEFAULT 'none',
`multiSql` TEXT NOT NULL,
`forwardMode` ENUM('auto', 'no', 'page') NOT NULL DEFAULT 'auto',
`forwardPage` VARCHAR(255) NOT NULL DEFAULT '',
`bsLabelColumns` VARCHAR(255) NOT NULL DEFAULT '',
`bsInputColumns` VARCHAR(255) NOT NULL DEFAULT '',
`bsNoteColumns` VARCHAR(255) NOT NULL DEFAULT '',
`deleted` ENUM('yes', 'no') NOT NULL DEFAULT 'no',
`modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `name` (`name`),
KEY `name_deleted` (`name`, `deleted`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8
AUTO_INCREMENT = 0;
#
# Create Demo Form
INSERT INTO Form (name, title, noteInternal, tableName, permitNew, permitEdit, multiSql) VALUES
('form', 'Form Editor', 'Please secure the form', 'Form', 'always', 'always', '');
--
-- Triggers `Form`
--
DROP TRIGGER IF EXISTS `on_Form_update_modified`;
DELIMITER //
CREATE TRIGGER `on_Form_update_modified` BEFORE UPDATE ON `Form`
FOR EACH ROW SET NEW.modified =
current_timestamp()
//
DELIMITER ;
# ----------------------------------------
# FormElement
DROP TABLE IF EXISTS `FormElement`;
CREATE TABLE IF NOT EXISTS `FormElement` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`formId` INT(11) NOT NULL,
`groupId` INT(11) NOT NULL DEFAULT '0',
`enabled` ENUM('yes', 'no') NOT NULL DEFAULT 'yes',
`name` VARCHAR(255) NOT NULL DEFAULT '',
`title` VARCHAR(255) NOT NULL DEFAULT '',
`mode` ENUM('show', 'readonly', 'required', 'lock'),
`class` ENUM('native|action|group'),
`type` ENUM('button', 'checkbox', 'date', 'datetime', 'email', 'grid', 'hidden', 'input', 'label',
'multiselect', 'note', 'radio', 'select', 'textarea', 'time', 'upload', 'url', 'before_load',
'before_save', 'before_insert', 'before_update', 'before_delete', 'after_load', 'after_save',
'after_insert', 'after_update', 'after_delete', 'group',
'sendmail') NOT NULL DEFAULT 'input',
`checkType` ENUM('min|max', 'pattern', 'number', 'email', 'url'),
`checkPattern` VARCHAR(255) NOT NULL DEFAULT '',
`onChange` VARCHAR(255) NOT NULL DEFAULT '',
`order` INT(11) NOT NULL DEFAULT '0',
`tabindex` INT(11) NOT NULL DEFAULT '0',
`autofocus` ENUM('yes', 'no') NOT NULL DEFAULT 'no',
`size` VARCHAR(255) NOT NULL DEFAULT '',
`maxLength` VARCHAR(255) NOT NULL DEFAULT '',
`label` VARCHAR(255) NOT NULL DEFAULT '',
`note` TEXT NOT NULL,
`tooltip` VARCHAR(255) NOT NULL DEFAULT '',
`clientJs` TEXT,
`value` TEXT NOT NULL,
`sql` TEXT NOT NULL,
`sql2` TEXT NOT NULL,
`parameter` TEXT NOT NULL,
`deleted` ENUM('yes', 'no') NOT NULL DEFAULT 'no',
`modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `formId` (`formId`),
KEY `formId_class_enabled_deleted` (`formId`, `class`, `enabled`, `deleted`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8
AUTO_INCREMENT = 0;
--
-- Triggers `FormElement`
--
DROP TRIGGER IF EXISTS `on_FormEelement_update_modified`;
DELIMITER //
CREATE TRIGGER `on_FormEelement_update_modified` BEFORE UPDATE ON `FormElement`
FOR EACH ROW SET NEW.modified =
current_timestamp()
//
DELIMITER ;
......@@ -8,7 +8,7 @@ CREATE TABLE person (
);
#
# Create Demo Form
# Create Demo
INSERT INTO person (id, name, firstname, gender, groups) VALUES
(NULL, 'Doe', 'John', 'male', 'c'),
(NULL, 'Smith', 'Jane', 'female', 'a,c');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment