|
| 1 | +-- Adminer 4.2.4 MySQL dump |
| 2 | + |
| 3 | +SET NAMES utf8; |
| 4 | +SET time_zone = '+00:00'; |
| 5 | +SET foreign_key_checks = 0; |
| 6 | +SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; |
| 7 | + |
| 8 | +DROP TABLE IF EXISTS `categories`; |
| 9 | +CREATE TABLE `categories` ( |
| 10 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 11 | + `name` varchar(255) NOT NULL, |
| 12 | + `icon` blob NULL, |
| 13 | + PRIMARY KEY (`id`) |
| 14 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
| 15 | + |
| 16 | +INSERT INTO `categories` (`id`, `name`, `icon`) VALUES |
| 17 | +(1, 'announcement', NULL), |
| 18 | +(2, 'article', NULL); |
| 19 | + |
| 20 | +DROP TABLE IF EXISTS `comments`; |
| 21 | +CREATE TABLE `comments` ( |
| 22 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 23 | + `post_id` int(11) NOT NULL, |
| 24 | + `message` varchar(255) NOT NULL, |
| 25 | + PRIMARY KEY (`id`), |
| 26 | + KEY `post_id` (`post_id`), |
| 27 | + CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) |
| 28 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
| 29 | + |
| 30 | +INSERT INTO `comments` (`id`, `post_id`, `message`) VALUES |
| 31 | +(1, 1, 'great'), |
| 32 | +(2, 1, 'fantastic'), |
| 33 | +(3, 2, 'thank you'), |
| 34 | +(4, 2, 'awesome'); |
| 35 | + |
| 36 | +DROP TABLE IF EXISTS `posts`; |
| 37 | +CREATE TABLE `posts` ( |
| 38 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 39 | + `user_id` int(11) NOT NULL, |
| 40 | + `category_id` int(11) NOT NULL, |
| 41 | + `content` varchar(255) NOT NULL, |
| 42 | + PRIMARY KEY (`id`), |
| 43 | + KEY `category_id` (`category_id`), |
| 44 | + KEY `user_id` (`user_id`), |
| 45 | + CONSTRAINT `posts_ibfk_3` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`), |
| 46 | + CONSTRAINT `posts_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) |
| 47 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
| 48 | + |
| 49 | +INSERT INTO `posts` (`id`, `user_id`, `category_id`, `content`) VALUES |
| 50 | +(1, 1, 1, 'blog started'), |
| 51 | +(2, 1, 2, 'It works!'); |
| 52 | + |
| 53 | +DROP TABLE IF EXISTS `post_tags`; |
| 54 | +CREATE TABLE `post_tags` ( |
| 55 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 56 | + `post_id` int(11) NOT NULL, |
| 57 | + `tag_id` int(11) NOT NULL, |
| 58 | + PRIMARY KEY (`id`), |
| 59 | + KEY `post_id` (`post_id`), |
| 60 | + KEY `tag_id` (`tag_id`), |
| 61 | + CONSTRAINT `post_tags_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`), |
| 62 | + CONSTRAINT `post_tags_ibfk_2` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) |
| 63 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
| 64 | + |
| 65 | +INSERT INTO `post_tags` (`id`, `post_id`, `tag_id`) VALUES |
| 66 | +(1, 1, 1), |
| 67 | +(2, 1, 2), |
| 68 | +(3, 2, 1), |
| 69 | +(4, 2, 2); |
| 70 | + |
| 71 | +DROP TABLE IF EXISTS `tags`; |
| 72 | +CREATE TABLE `tags` ( |
| 73 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 74 | + `name` varchar(255) NOT NULL, |
| 75 | + PRIMARY KEY (`id`) |
| 76 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
| 77 | + |
| 78 | +INSERT INTO `tags` (`id`, `name`) VALUES |
| 79 | +(1, 'funny'), |
| 80 | +(2, 'important'); |
| 81 | + |
| 82 | +DROP TABLE IF EXISTS `users`; |
| 83 | +CREATE TABLE `users` ( |
| 84 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 85 | + `username` varchar(255) NOT NULL, |
| 86 | + `password` varchar(255) NOT NULL, |
| 87 | + `location` text NULL, |
| 88 | + PRIMARY KEY (`id`) |
| 89 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
| 90 | + |
| 91 | +INSERT INTO `users` (`id`, `username`, `password`, `location`) VALUES |
| 92 | +(1, 'user1', 'pass1', null), |
| 93 | +(2, 'user2', 'pass2', null); |
| 94 | + |
| 95 | +DROP TABLE IF EXISTS `countries`; |
| 96 | +CREATE TABLE `countries` ( |
| 97 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 98 | + `name` varchar(255) NOT NULL, |
| 99 | + PRIMARY KEY (`id`) |
| 100 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
| 101 | + |
| 102 | +INSERT INTO `countries` (`id`, `name`) VALUES |
| 103 | +(1, 'Left'), |
| 104 | +(2, 'Right'); |
| 105 | + |
| 106 | +DROP TABLE IF EXISTS `events`; |
| 107 | +CREATE TABLE `events` ( |
| 108 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 109 | + `name` varchar(255) NOT NULL, |
| 110 | + `datetime` datetime NOT NULL, |
| 111 | + `visitors` int(11) NOT NULL, |
| 112 | + PRIMARY KEY (`id`) |
| 113 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
| 114 | + |
| 115 | +INSERT INTO `events` (`id`, `name`, `datetime`, `visitors`) VALUES |
| 116 | +(1, 'Launch', '2016-01-01 13:01:01', 0); |
| 117 | + |
| 118 | +DROP VIEW IF EXISTS `tag_usage`; |
| 119 | +CREATE VIEW `tag_usage` AS select `name`, count(`name`) AS `count` from `tags`, `post_tags` where `tags`.`id` = `post_tags`.`tag_id` group by `name` order by `count` desc, `name`; |
| 120 | + |
| 121 | +DROP TABLE IF EXISTS `products`; |
| 122 | +CREATE TABLE `products` ( |
| 123 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 124 | + `name` varchar(255) NOT NULL, |
| 125 | + `price` decimal(10,2) NOT NULL, |
| 126 | + `properties` text NOT NULL, |
| 127 | + `created_at` datetime NOT NULL, |
| 128 | + `deleted_at` datetime NULL, |
| 129 | + PRIMARY KEY (`id`) |
| 130 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
| 131 | + |
| 132 | +INSERT INTO `products` (`id`, `name`, `price`, `properties`, `created_at`) VALUES |
| 133 | +(1, 'Calculator', '23.01', '{"depth":false,"model":"TRX-120","width":100,"height":null}', '1970-01-01 01:01:01'); |
| 134 | + |
| 135 | +DROP TABLE IF EXISTS `barcodes`; |
| 136 | +CREATE TABLE `barcodes` ( |
| 137 | + `id` int(11) NOT NULL AUTO_INCREMENT, |
| 138 | + `product_id` int(11) NOT NULL, |
| 139 | + `hex` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL, |
| 140 | + `bin` varbinary(255) NOT NULL, |
| 141 | + PRIMARY KEY (`id`), |
| 142 | + CONSTRAINT `barcodes_ibfk_1` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) |
| 143 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
| 144 | + |
| 145 | +INSERT INTO `barcodes` (`id`, `product_id`, `hex`, `bin`) VALUES |
| 146 | +(1, 1, '00ff01', UNHEX('00ff01')); |
| 147 | + |
| 148 | +-- 2016-11-05 13:11:47 |
0 commit comments