PHP Classes

File: install.sql

Recommend this page to a friend!
  Classes of Vitalij Mik   Doctrine PHP ORM Example   install.sql   Download  
File: install.sql
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Doctrine PHP ORM Example
Examples of storing objects using Doctrine
Author: By
Last change:
Date: 2 years ago
Size: 6,003 bytes
 

Contents

Class file image Download
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET NAMES utf8 */; /*!50503 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `user`; CREATE TABLE IF NOT EXISTS `user` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(191) NOT NULL DEFAULT '0', `password` varchar(191) NOT NULL DEFAULT '0', `email` varchar(512) NOT NULL DEFAULT '0', `activationKey` varchar(8) DEFAULT NULL, `userRights` enum('USER','ADMIN') DEFAULT 'USER', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`), UNIQUE KEY `email` (`email`), KEY `activationKey` (`username`,`activationKey`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; DROP TABLE IF EXISTS `categories`; CREATE TABLE IF NOT EXISTS `categories` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `label` varchar(200) NOT NULL DEFAULT '0', `parentId` int(10) unsigned DEFAULT NULL, `position` int(10) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; DROP TABLE IF EXISTS `products`; CREATE TABLE IF NOT EXISTS `products` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(191) CHARACTER SET utf8 NOT NULL, `description` text CHARACTER SET utf8 NOT NULL, `price` int(11) NOT NULL DEFAULT 0, `status` enum('DRAFT','LIVE') NOT NULL DEFAULT 'DRAFT', `slug` varchar(140) NOT NULL DEFAULT '', `category_id` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `slug` (`slug`), KEY `FK_product_category` (`category_id`), CONSTRAINT `FK_product_category` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL ON UPDATE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; DROP TABLE IF EXISTS `cart`; CREATE TABLE IF NOT EXISTS `cart` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(10) unsigned NOT NULL DEFAULT 0, `product_id` int(10) unsigned DEFAULT NULL, `quantity` int(10) unsigned NOT NULL DEFAULT 0, `created` datetime NOT NULL DEFAULT current_timestamp(), PRIMARY KEY (`id`), UNIQUE KEY `product_id_user_id` (`product_id`,`user_id`), KEY `user_id` (`user_id`), CONSTRAINT `FK_cart_product` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; DROP TABLE IF EXISTS `delivery_adresses`; CREATE TABLE IF NOT EXISTS `delivery_adresses` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `user_id` int(11) unsigned NOT NULL, `recipient` text NOT NULL, `city` text NOT NULL, `street` text NOT NULL, `streetNumber` varchar(50) NOT NULL, `zipCode` varchar(50) NOT NULL, PRIMARY KEY (`id`), KEY `FK_user_delivery_addresses` (`user_id`), CONSTRAINT `FK_user_delivery_addresses` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; DROP TABLE IF EXISTS `orders`; CREATE TABLE IF NOT EXISTS `orders` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `orderDate` date NOT NULL DEFAULT '0000-00-00', `deliveryDate` date NOT NULL DEFAULT '0000-00-00', `status` enum('new','canceled','payed','sent','delivered') NOT NULL DEFAULT 'new', `userId` int(10) unsigned NOT NULL, PRIMARY KEY (`id`), KEY `orderDate` (`orderDate`), KEY `status` (`status`), KEY `userId` (`userId`), CONSTRAINT `FK_ORDER_TO_USER` FOREIGN KEY (`userId`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; DROP TABLE IF EXISTS `order_adresses`; CREATE TABLE IF NOT EXISTS `order_adresses` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `order_id` int(11) unsigned NOT NULL, `recipient` mediumtext NOT NULL, `city` text NOT NULL, `street` text NOT NULL, `streetNumber` varchar(50) NOT NULL, `zipCode` varchar(50) NOT NULL, `type` enum('both','delivery','invoice') DEFAULT 'both', PRIMARY KEY (`id`), KEY `FK_ORDER_ADRESS` (`order_id`), KEY `type` (`type`), CONSTRAINT `FK_ORDER_ADRESS` FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; DROP TABLE IF EXISTS `order_products`; CREATE TABLE IF NOT EXISTS `order_products` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(50) NOT NULL DEFAULT '', `quantity` int(10) unsigned NOT NULL DEFAULT 0, `price` int(10) unsigned NOT NULL DEFAULT 0, `taxInPercent` int(10) unsigned NOT NULL DEFAULT 0, `orderId` int(10) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (`id`), KEY `FK_ODERS_TO_ORDER_PRODUCTS` (`orderId`), CONSTRAINT `FK_ODERS_TO_ORDER_PRODUCTS` FOREIGN KEY (`orderId`) REFERENCES `orders` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; CREATE TABLE IF NOT EXISTS `reviews` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `product_id` int(10) unsigned NOT NULL, `user_id` int(10) unsigned NOT NULL, `value` int(10) unsigned NOT NULL, `title` varchar(50) NOT NULL DEFAULT '', `text` text NOT NULL, `created` datetime NOT NULL, `status` enum('PUBLIC','PRIVATE') NOT NULL DEFAULT 'PRIVATE', PRIMARY KEY (`id`), UNIQUE KEY `product_id_user_id` (`product_id`,`user_id`), KEY `product_id_status` (`product_id`,`status`), KEY `FK_USER_REVIEWS` (`user_id`), CONSTRAINT `FK_PRODUCT_REVIEWS` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `FK_USER_REVIEWS` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;