From cc8f3bfa658ccb5143e7cae937c3133d73e04be7 Mon Sep 17 00:00:00 2001 From: Jens Date: Wed, 3 Feb 2021 22:59:14 +0100 Subject: [PATCH] Included SQL schema --- ShoppingList/database-schema.sql | 162 +++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 ShoppingList/database-schema.sql diff --git a/ShoppingList/database-schema.sql b/ShoppingList/database-schema.sql new file mode 100644 index 0000000..cfd50e5 --- /dev/null +++ b/ShoppingList/database-schema.sql @@ -0,0 +1,162 @@ +-- phpMyAdmin SQL Dump +-- version 5.0.4 +-- https://www.phpmyadmin.net/ +-- +-- Host: privoxy.brainscanner.dyndns.org +-- Generation Time: Dec 31, 2020 at 06:37 PM +-- Server version: 10.3.27-MariaDB-0+deb10u1 +-- PHP Version: 7.3.6 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +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 utf8mb4 */; + +-- +-- Database: `shoppingList` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `listEntries` +-- + +CREATE TABLE `listEntries` ( + `listId` int(11) NOT NULL, + `productId` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `lists` +-- + +CREATE TABLE `lists` ( + `id` int(11) NOT NULL, + `creationTime` bigint(20) NOT NULL, + `comment` varchar(200) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `products` +-- + +CREATE TABLE `products` ( + `id` int(11) NOT NULL, + `name` varchar(100) NOT NULL, + `synonyms` varchar(500) DEFAULT NULL COMMENT 'Separate entries with semicolons.', + `storeTypeId` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `settings` +-- + +CREATE TABLE `settings` ( + `settingName` varchar(100) NOT NULL, + `settingValue` varchar(100) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `storeTypes` +-- + +CREATE TABLE `storeTypes` ( + `id` int(11) NOT NULL, + `name` varchar(200) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `listEntries` +-- +ALTER TABLE `listEntries` + ADD PRIMARY KEY (`listId`,`productId`), + ADD KEY `productId` (`productId`); + +-- +-- Indexes for table `lists` +-- +ALTER TABLE `lists` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `products` +-- +ALTER TABLE `products` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `name` (`name`), + ADD KEY `storeTypeId` (`storeTypeId`); + +-- +-- Indexes for table `settings` +-- +ALTER TABLE `settings` + ADD PRIMARY KEY (`settingName`); + +-- +-- Indexes for table `storeTypes` +-- +ALTER TABLE `storeTypes` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `name` (`name`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `lists` +-- +ALTER TABLE `lists` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT for table `products` +-- +ALTER TABLE `products` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT for table `storeTypes` +-- +ALTER TABLE `storeTypes` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; + +-- +-- Constraints for dumped tables +-- + +-- +-- Constraints for table `listEntries` +-- +ALTER TABLE `listEntries` + ADD CONSTRAINT `listEntries_ibfk_1` FOREIGN KEY (`listId`) REFERENCES `lists` (`id`), + ADD CONSTRAINT `listEntries_ibfk_2` FOREIGN KEY (`productId`) REFERENCES `products` (`id`); + +-- +-- Constraints for table `products` +-- +ALTER TABLE `products` + ADD CONSTRAINT `products_ibfk_1` FOREIGN KEY (`storeTypeId`) REFERENCES `storeTypes` (`id`); +COMMIT; + +/*!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 */;