· 8 years ago · Jan 15, 2018, 12:38 PM
1SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
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: `nextgame`
--
CREATE DATABASE IF NOT EXISTS `nextgame` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `nextgame`;

-- --------------------------------------------------------

--
-- Table structure for table `coupons`
--

CREATE TABLE `coupons` (
 `couponID` int(11) NOT NULL,
 `couponcode` varchar(30) NOT NULL,
 `discount` int(11) NOT NULL,
 `valid` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `customers`
--

CREATE TABLE `customers` (
 `customerID` int(11) NOT NULL,
 `firstname` varchar(100) COLLATE utf8mb4_bin NOT NULL,
 `lastname` varchar(100) COLLATE utf8mb4_bin NOT NULL,
 `email` varchar(150) COLLATE utf8mb4_bin NOT NULL,
 `username` varchar(50) COLLATE utf8mb4_bin NOT NULL,
 `password` varchar(50) COLLATE utf8mb4_bin NOT NULL,
 `token` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

-- --------------------------------------------------------

--
-- Table structure for table `gamekeys`
--

CREATE TABLE `gamekeys` (
 `gamekeyID` int(11) NOT NULL,
 `gameID` int(11) NOT NULL,
 `key` varchar(150) NOT NULL,
 `platform` varchar(50) NOT NULL,
 `price` decimal(10,0) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `games`
--

CREATE TABLE `games` (
 `gameID` int(11) NOT NULL,
 `gamekeyID` int(11) NOT NULL,
 `title` varchar(100) NOT NULL,
 `description` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `game_orders`
--

CREATE TABLE `game_orders` (
 `orderID` int(11) NOT NULL,
 `gamekeyID` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
 `orderID` int(100) NOT NULL,
 `customerID` int(100) NOT NULL,
 `totalprice` decimal(10,0) NOT NULL,
 `discount` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `coupons`
--
ALTER TABLE `coupons`
 ADD PRIMARY KEY (`couponID`);

--
-- Indexes for table `customers`
--
ALTER TABLE `customers`
 ADD PRIMARY KEY (`customerID`);

--
-- Indexes for table `gamekeys`
--
ALTER TABLE `gamekeys`
 ADD PRIMARY KEY (`gamekeyID`);

--
-- Indexes for table `games`
--
ALTER TABLE `games`
 ADD PRIMARY KEY (`gameID`);

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
 ADD PRIMARY KEY (`orderID`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `coupons`
--
ALTER TABLE `coupons`
 MODIFY `couponID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `customers`
--
ALTER TABLE `customers`
 MODIFY `customerID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `gamekeys`
--
ALTER TABLE `gamekeys`
 MODIFY `gamekeyID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `games`
--
ALTER TABLE `games`
 MODIFY `gameID` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
 MODIFY `orderID` int(100) NOT NULL AUTO_INCREMENT;
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 */;-- phpMyAdmin SQL Dump
2-- version 4.7.4
3-- https://www.phpmyadmin.net/
4--
5-- Host: localhost:3306
6-- Generation Time: Dec 19, 2017 at 05:23 AM
7-- Server version: 5.7.20
8-- PHP Version: 7.1.12
9
10SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11SET AUTOCOMMIT = 0;
12START TRANSACTION;
13SET time_zone = "+00:00";
14
15
16/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
17/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
18/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
19/*!40101 SET NAMES utf8mb4 */;
20
21--
22-- Database: `nextgame`
23--
24CREATE DATABASE IF NOT EXISTS `nextgame` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
25USE `nextgame`;
26
27-- --------------------------------------------------------
28
29--
30-- Table structure for table `coupons`
31--
32
33CREATE TABLE `coupons` (
34 `couponID` int(11) NOT NULL,
35 `couponcode` varchar(30) NOT NULL,
36 `discount` int(11) NOT NULL,
37 `valid` tinyint(1) NOT NULL
38) ENGINE=InnoDB DEFAULT CHARSET=utf8;
39
40-- --------------------------------------------------------
41
42--
43-- Table structure for table `customers`
44--
45
46CREATE TABLE `customers` (
47 `customerID` int(11) NOT NULL,
48 `firstname` varchar(100) COLLATE utf8mb4_bin NOT NULL,
49 `lastname` varchar(100) COLLATE utf8mb4_bin NOT NULL,
50 `email` varchar(150) COLLATE utf8mb4_bin NOT NULL,
51 `username` varchar(50) COLLATE utf8mb4_bin NOT NULL,
52 `password` varchar(50) COLLATE utf8mb4_bin NOT NULL,
53 `token` varchar(150) COLLATE utf8mb4_bin DEFAULT NULL
54) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
55
56-- --------------------------------------------------------
57
58--
59-- Table structure for table `gamekeys`
60--
61
62CREATE TABLE `gamekeys` (
63 `gamekeyID` int(11) NOT NULL,
64 `gameID` int(11) NOT NULL,
65 `key` varchar(150) NOT NULL,
66 `platform` varchar(50) NOT NULL,
67 `price` decimal(10,0) NOT NULL
68) ENGINE=InnoDB DEFAULT CHARSET=utf8;
69
70-- --------------------------------------------------------
71
72--
73-- Table structure for table `games`
74--
75
76CREATE TABLE `games` (
77 `gameID` int(11) NOT NULL,
78 `gamekeyID` int(11) NOT NULL,
79 `title` varchar(100) NOT NULL,
80 `description` varchar(500) NOT NULL
81) ENGINE=InnoDB DEFAULT CHARSET=utf8;
82
83-- --------------------------------------------------------
84
85--
86-- Table structure for table `game_orders`
87--
88
89CREATE TABLE `game_orders` (
90 `orderID` int(11) NOT NULL,
91 `gamekeyID` int(11) NOT NULL
92) ENGINE=InnoDB DEFAULT CHARSET=utf8;
93
94-- --------------------------------------------------------
95
96--
97-- Table structure for table `orders`
98--
99
100CREATE TABLE `orders` (
101 `orderID` int(100) NOT NULL,
102 `customerID` int(100) NOT NULL,
103 `totalprice` decimal(10,0) NOT NULL,
104 `discount` tinyint(1) NOT NULL
105) ENGINE=InnoDB DEFAULT CHARSET=utf8;
106
107--
108-- Indexes for dumped tables
109--
110
111--
112-- Indexes for table `coupons`
113--
114ALTER TABLE `coupons`
115 ADD PRIMARY KEY (`couponID`);
116
117--
118-- Indexes for table `customers`
119--
120ALTER TABLE `customers`
121 ADD PRIMARY KEY (`customerID`);
122
123--
124-- Indexes for table `gamekeys`
125--
126ALTER TABLE `gamekeys`
127 ADD PRIMARY KEY (`gamekeyID`);
128
129--
130-- Indexes for table `games`
131--
132ALTER TABLE `games`
133 ADD PRIMARY KEY (`gameID`);
134
135--
136-- Indexes for table `orders`
137--
138ALTER TABLE `orders`
139 ADD PRIMARY KEY (`orderID`);
140
141--
142-- AUTO_INCREMENT for dumped tables
143--
144
145--
146-- AUTO_INCREMENT for table `coupons`
147--
148ALTER TABLE `coupons`
149 MODIFY `couponID` int(11) NOT NULL AUTO_INCREMENT;
150
151--
152-- AUTO_INCREMENT for table `customers`
153--
154ALTER TABLE `customers`
155 MODIFY `customerID` int(11) NOT NULL AUTO_INCREMENT;
156
157--
158-- AUTO_INCREMENT for table `gamekeys`
159--
160ALTER TABLE `gamekeys`
161 MODIFY `gamekeyID` int(11) NOT NULL AUTO_INCREMENT;
162
163--
164-- AUTO_INCREMENT for table `games`
165--
166ALTER TABLE `games`
167 MODIFY `gameID` int(11) NOT NULL AUTO_INCREMENT;
168
169--
170-- AUTO_INCREMENT for table `orders`
171--
172ALTER TABLE `orders`
173 MODIFY `orderID` int(100) NOT NULL AUTO_INCREMENT;
174COMMIT;
175
176/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
177/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
178/*!40101 SET COLLATION_CONNECTION=@OLD_CO