CREATE TABLE IF NOT EXISTS `sql_template` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
  `title` varchar(150) NOT NULL,
  `text` mediumtext NOT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `sql_history_config` (
    `id` int NOT NULL AUTO_INCREMENT,
    `user_id` int NOT NULL DEFAULT 0,
    `save_in_database` int NOT NULL DEFAULT 0,
    `keep_period_type` int NOT NULL DEFAULT 0,
    PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `sql_history_request` (
    `id` int NOT NULL AUTO_INCREMENT,
    `user_id` int NOT NULL DEFAULT 0,
    `request` text NOT NULL DEFAULT '',
    `create_date` datetime NULL,
    PRIMARY KEY (`id`)
);