This repository was archived by the owner on Nov 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
sql dump
choutha edited this page Mar 1, 2015
·
1 revision
-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Machine: localhost
-- Genereertijd: 01 mrt 2015 om 17:26
-- Serverversie: 5.5.40-0ubuntu0.14.04.1
-- PHP-versie: 5.5.9-1ubuntu4.5
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Databank: `sudosos`
--
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `category`
--
CREATE TABLE IF NOT EXISTS `category` (
`categoryId` int(11) NOT NULL,
`name` text NOT NULL,
`ownerId` int(11) NOT NULL,
PRIMARY KEY (`categoryId`),
KEY `categoryId` (`categoryId`,`ownerId`),
KEY `categoryId_2` (`categoryId`),
KEY `ownerId` (`ownerId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `inventory`
--
CREATE TABLE IF NOT EXISTS `inventory` (
`inventoryId` int(11) NOT NULL,
`storageID` int(11) NOT NULL,
`productID` int(11) NOT NULL,
`stock` int(11) NOT NULL,
PRIMARY KEY (`inventoryId`),
KEY `storageID` (`storageID`,`productID`),
KEY `productID` (`productID`),
KEY `inventoryId` (`inventoryId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `inventoryPointOfSales`
--
CREATE TABLE IF NOT EXISTS `inventoryPointOfSales` (
`inventoryId` int(11) NOT NULL,
`pointOfSalesId` int(11) NOT NULL,
`categoryId` int(11) NOT NULL,
PRIMARY KEY (`inventoryId`,`pointOfSalesId`),
KEY `inventoryId` (`inventoryId`,`categoryId`),
KEY `categoryId` (`categoryId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `pointOfSales`
--
CREATE TABLE IF NOT EXISTS `pointOfSales` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`ownerID` int(11) NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `id` (`id`),
KEY `ownerID` (`ownerID`),
KEY `id_2` (`id`,`ownerID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `product`
--
CREATE TABLE IF NOT EXISTS `product` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`price` int(11) NOT NULL,
`image` blob,
`traySize` int(11) DEFAULT NULL,
`ownerID` int(11) NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `id` (`id`,`ownerID`),
KEY `ownerID` (`ownerID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;
--
-- Gegevens worden uitgevoerd voor tabel `product`
--
INSERT INTO `product` (`id`, `name`, `price`, `image`, `traySize`, `ownerID`, `active`) VALUES
(14, 'testStefan', 70, NULL, 24, 1, 1),
(15, 'testStefan2', 70, 0x687474703a2e2e2e2e626c6f626c, 24, 1, 0),
(16, 'Jenkins', 1000, '', 24, 1, 0);
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `productCategory`
--
CREATE TABLE IF NOT EXISTS `productCategory` (
`productId` int(11) NOT NULL,
`categoryId` int(11) NOT NULL,
PRIMARY KEY (`productId`,`categoryId`),
KEY `categoryId` (`categoryId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `storage`
--
CREATE TABLE IF NOT EXISTS `storage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`responsibleID` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `id` (`id`,`responsibleID`),
KEY `responsibleID` (`responsibleID`),
KEY `id_2` (`id`,`responsibleID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `transaction`
--
CREATE TABLE IF NOT EXISTS `transaction` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'The id of the transaction.',
`totalPrice` int(11) NOT NULL COMMENT 'The price in cents handled in the transaction.',
`activityID` int(11) NOT NULL,
`storageID` int(11) NOT NULL,
`soldToID` int(11) NOT NULL,
`authorizedID` int(11) NOT NULL,
`productID` int(11) NOT NULL,
`amount` int(11) NOT NULL,
`productOwnerID` int(11) NOT NULL,
`type` varchar(255) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`comment` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `productOwnerID` (`productOwnerID`),
KEY `id` (`id`,`amount`,`productOwnerID`),
KEY `id_2` (`id`,`amount`,`productOwnerID`),
KEY `id_3` (`id`,`storageID`,`soldToID`,`authorizedID`,`productID`,`productOwnerID`),
KEY `authorizedID` (`authorizedID`),
KEY `soldToID` (`soldToID`),
KEY `activityID` (`activityID`),
KEY `productID` (`productID`),
KEY `storageID` (`storageID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gewisID` int(11) DEFAULT NULL,
`type` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `id` (`id`),
KEY `gewisID` (`gewisID`),
KEY `id_2` (`id`,`gewisID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Gegevens worden uitgevoerd voor tabel `users`
--
INSERT INTO `users` (`id`, `gewisID`, `type`, `name`) VALUES
(1, 3, 'GEWIS', 'test');
--
-- Beperkingen voor gedumpte tabellen
--
--
-- Beperkingen voor tabel `category`
--
ALTER TABLE `category`
ADD CONSTRAINT `category_ibfk_1` FOREIGN KEY (`ownerId`) REFERENCES `users` (`id`);
--
-- Beperkingen voor tabel `inventory`
--
ALTER TABLE `inventory`
ADD CONSTRAINT `inventory_ibfk_1` FOREIGN KEY (`storageID`) REFERENCES `storage` (`id`),
ADD CONSTRAINT `inventory_ibfk_2` FOREIGN KEY (`productID`) REFERENCES `product` (`id`);
--
-- Beperkingen voor tabel `inventoryPointOfSales`
--
ALTER TABLE `inventoryPointOfSales`
ADD CONSTRAINT `inventoryPointOfSales_ibfk_1` FOREIGN KEY (`inventoryId`) REFERENCES `inventory` (`inventoryId`),
ADD CONSTRAINT `inventoryPointOfSales_ibfk_2` FOREIGN KEY (`categoryId`) REFERENCES `category` (`categoryId`);
--
-- Beperkingen voor tabel `pointOfSales`
--
ALTER TABLE `pointOfSales`
ADD CONSTRAINT `pointOfSales_ibfk_1` FOREIGN KEY (`ownerID`) REFERENCES `users` (`id`);
--
-- Beperkingen voor tabel `product`
--
ALTER TABLE `product`
ADD CONSTRAINT `product_ibfk_2` FOREIGN KEY (`ownerID`) REFERENCES `users` (`id`);
--
-- Beperkingen voor tabel `productCategory`
--
ALTER TABLE `productCategory`
ADD CONSTRAINT `productCategory_ibfk_2` FOREIGN KEY (`categoryId`) REFERENCES `category` (`categoryId`),
ADD CONSTRAINT `productCategory_ibfk_1` FOREIGN KEY (`productId`) REFERENCES `product` (`id`);
--
-- Beperkingen voor tabel `storage`
--
ALTER TABLE `storage`
ADD CONSTRAINT `storage_ibfk_1` FOREIGN KEY (`responsibleID`) REFERENCES `users` (`id`);
--
-- Beperkingen voor tabel `transaction`
--
ALTER TABLE `transaction`
ADD CONSTRAINT `transaction_ibfk_6` FOREIGN KEY (`storageID`) REFERENCES `storage` (`id`),
ADD CONSTRAINT `transaction_ibfk_1` FOREIGN KEY (`authorizedID`) REFERENCES `users` (`id`),
ADD CONSTRAINT `transaction_ibfk_2` FOREIGN KEY (`soldToID`) REFERENCES `users` (`id`),
ADD CONSTRAINT `transaction_ibfk_3` FOREIGN KEY (`activityID`) REFERENCES `pointOfSales` (`id`),
ADD CONSTRAINT `transaction_ibfk_4` FOREIGN KEY (`productID`) REFERENCES `product` (`id`),
ADD CONSTRAINT `transaction_ibfk_5` FOREIGN KEY (`productOwnerID`) REFERENCES `users` (`id`);