You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
BinStack/database_upgrade/v1.1_1.2.sql

29 lines
953 B
SQL

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
ALTER TABLE `items`
ADD COLUMN `cost` DECIMAL(10,2) NULL DEFAULT NULL AFTER `userid`,
ADD COLUMN `price` DECIMAL(10,2) NULL DEFAULT NULL AFTER `cost`;\
ALTER TABLE `items`
DROP PRIMARY KEY,
ADD PRIMARY KEY (`itemid`);
CREATE TABLE IF NOT EXISTS `images` (
`imageid` INT(11) NOT NULL AUTO_INCREMENT,
`itemid` INT(11) NOT NULL,
`imagename` VARCHAR(255) NOT NULL,
`primary` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`imageid`, `itemid`),
UNIQUE INDEX `imageid_UNIQUE` (`imageid` ASC),
INDEX `fk_images_items1_idx` (`itemid` ASC),
CONSTRAINT `fk_images_items1`
FOREIGN KEY (`itemid`)
REFERENCES `inventory`.`items` (`itemid`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8