From 981e75dfdb79ba5dcda672ccaf504cab883e7621 Mon Sep 17 00:00:00 2001 From: botanic Date: Thu, 4 Sep 2014 21:34:57 -0700 Subject: [PATCH] added new ticket_attachment table to installer properly --- .../setup/sql/nel_ams_lib_00001.sql | 27 ------- .../setup/sql/nel_ams_lib_00002.sql | 70 +++++++++++++++++++ code/web/public_php/setup/index.php | 1 + 3 files changed, 71 insertions(+), 27 deletions(-) create mode 100644 code/web/private_php/setup/sql/nel_ams_lib_00002.sql diff --git a/code/web/private_php/setup/sql/nel_ams_lib_00001.sql b/code/web/private_php/setup/sql/nel_ams_lib_00001.sql index 2acbb695f..3c9b259b3 100644 --- a/code/web/private_php/setup/sql/nel_ams_lib_00001.sql +++ b/code/web/private_php/setup/sql/nel_ams_lib_00001.sql @@ -304,33 +304,6 @@ CREATE TABLE IF NOT EXISTS `updates` ( `UpdateInfo` text CHARACTER SET utf8 COLLATE utf8_unicode_ci ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- ----------------------------------------------------- --- Table `nel_ams_lib`.`ticket_attachments` --- ----------------------------------------------------- - -CREATE TABLE IF NOT EXISTS `nel_ams_lib`.`ticket_attachments` ( - `idticket_attachments` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, - `ticket_TId` INT(10) UNSIGNED NOT NULL, - `Filename` VARCHAR(45) NOT NULL, - `Timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `Filesize` INT(10) NOT NULL, - `Uploader` INT(10) UNSIGNED NOT NULL, - PRIMARY KEY (`idticket_attachments`), - UNIQUE INDEX `idticket_attachments_UNIQUE` (`idticket_attachments` ASC), - INDEX `fk_ticket_attachments_ticket1_idx` (`ticket_TId` ASC), - INDEX `fk_ticket_attachments_ticket_user1_idx` (`Uploader` ASC), - CONSTRAINT `fk_ticket_attachments_ticket1` - FOREIGN KEY (`ticket_TId`) - REFERENCES `nel_ams_lib`.`ticket` (`TId`) - ON DELETE NO ACTION - ON UPDATE NO ACTION, - CONSTRAINT `fk_ticket_attachments_ticket_user1` - FOREIGN KEY (`Uploader`) - REFERENCES `nel_ams_lib`.`ticket_user` (`TUserId`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB; - -- -- Indexes for dumped tables -- diff --git a/code/web/private_php/setup/sql/nel_ams_lib_00002.sql b/code/web/private_php/setup/sql/nel_ams_lib_00002.sql new file mode 100644 index 000000000..101858db2 --- /dev/null +++ b/code/web/private_php/setup/sql/nel_ams_lib_00002.sql @@ -0,0 +1,70 @@ +-- phpMyAdmin SQL Dump +-- version 4.2.8 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: Sep 04, 2014 at 09:28 PM +-- Server version: 5.6.17 +-- PHP Version: 5.5.12 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Database: `nel_ams_lib` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ticket_attachments` +-- + +CREATE TABLE IF NOT EXISTS `ticket_attachments` ( +`idticket_attachments` int(10) unsigned NOT NULL, + `ticket_TId` int(10) unsigned NOT NULL, + `Filename` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `Filesize` int(10) NOT NULL, + `Uploader` int(10) unsigned NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `ticket_attachments` +-- +ALTER TABLE `ticket_attachments` + ADD PRIMARY KEY (`idticket_attachments`), ADD UNIQUE KEY `idticket_attachments_UNIQUE` (`idticket_attachments`), ADD KEY `fk_ticket_attachments_ticket1_idx` (`ticket_TId`), ADD KEY `fk_ticket_attachments_ticket_user1_idx` (`Uploader`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `ticket_attachments` +-- +ALTER TABLE `ticket_attachments` +MODIFY `idticket_attachments` int(10) unsigned NOT NULL AUTO_INCREMENT; +-- +-- Constraints for dumped tables +-- + +-- +-- Constraints for table `ticket_attachments` +-- +ALTER TABLE `ticket_attachments` +ADD CONSTRAINT `fk_ticket_attachments_ticket1` FOREIGN KEY (`ticket_TId`) REFERENCES `ticket` (`TId`) ON DELETE NO ACTION ON UPDATE NO ACTION, +ADD CONSTRAINT `fk_ticket_attachments_ticket_user1` FOREIGN KEY (`Uploader`) REFERENCES `ticket_user` (`TUserId`) ON DELETE NO ACTION ON UPDATE NO ACTION; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/code/web/public_php/setup/index.php b/code/web/public_php/setup/index.php index a02d9e9e6..00dcda9ea 100644 --- a/code/web/public_php/setup/index.php +++ b/code/web/public_php/setup/index.php @@ -160,6 +160,7 @@ function update_database_structure($continue_r, $con, $file) { // Create AMS Library database $continue = create_use_database($continue, $con, $_POST["amsLibDatabase"]); $continue = update_database_structure($continue, $con, "nel_ams_lib_00001.sql"); + $continue = update_database_structure($continue, $con, "nel_ams_lib_00002.sql"); // Write config.php if ($continue) {