-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
64 lines (49 loc) · 1.24 KB
/
schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
DROP DATABASE IF EXISTS sneakers;
CREATE DATABASE sneakers;
USE sneakers;
-- ---
-- Globals
-- ---
-- SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- SET FOREIGN_KEY_CHECKS=0;
-- ---
-- Table 'users'
--
-- ---
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`username` VARCHAR(25) NULL DEFAULT NULL,
PRIMARY KEY (`id`)
);
-- ---
-- Table 'sneakers'
--
-- ---
DROP TABLE IF EXISTS `favorites`;
CREATE TABLE `favorites` (
`id` INTEGER NOT NULL AUTO_INCREMENT,
`name` VARCHAR(75) NULL DEFAULT NULL,
`url` VARCHAR(75) NULL DEFAULT NULL,
`media` VARCHAR(300) NULL DEFAULT NULL,
`highestbid` MEDIUMTEXT NULL DEFAULT NULL,
`lastsale` MEDIUMTEXT NULL DEFAULT NULL,
`user_id` INTEGER NULL DEFAULT NULL,
PRIMARY KEY (`id`)
);
-- ---
-- Foreign Keys
-- ---
ALTER TABLE `favorites` ADD FOREIGN KEY (user_id) REFERENCES `users` (`id`);
-- ---
-- Table Properties
-- ---
-- ALTER TABLE `users` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ALTER TABLE `sneakers` ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ---
-- Test Data
-- ---
-- INSERT INTO `users` (`id`,`username`) VALUES
-- ('','');
-- INSERT INTO `sneakers` (`id`,`name`,`size`,`highestbid`,`user_id`) VALUES
-- ('','','','','');