-
Notifications
You must be signed in to change notification settings - Fork 0
/
importable.sql
81 lines (73 loc) · 2.47 KB
/
importable.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
CREATE TABLE listingData (
`ListingId` smallint unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(100) NOT NULL,
`Seller` varchar(100) NOT NULL,
`Price` float NOT NULL,
`Description` varchar(300) NOT NULL,
`PhoneNumber` varchar(100) NOT NULL,
`Email` varchar(100) NOT NULL,
`image_url` varchar(300) NOT NULL,
`UserId` smallint unsigned NOT NULL,
`isGiveaway` tinyint(1) NOT NULL DEFAULT 0,
`isAuction` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (ListingId)
);
CREATE TABLE auctionsData (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`title` VARCHAR(255) NOT NULL,
`description` TEXT NOT NULL,
`image_url` VARCHAR(255) NOT NULL,
`starting_bid` DECIMAL(10, 2) NOT NULL,
`time_posted` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`time_end` DATETIME NOT NULL
);
CREATE TABLE bidsData (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`auction_id` INT NOT NULL,
`bidder_id` INT NOT NULL,
`bidder_name` VARCHAR(255),
`bid_amount` DECIMAL(10, 2) NOT NULL,
`bid_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`anonymous` BOOLEAN DEFAULT 0,
FOREIGN KEY (auction_id) REFERENCES auctionsData(id)
);
CREATE TABLE `loginData` (
`UserId` smallint unsigned NOT NULL AUTO_INCREMENT,
`Username` varchar(100) NOT NULL,
`Password` varchar(100) NOT NULL,
`Name` varchar(100) NOT NULL,
`PhoneNumber` varchar(100) NOT NULL,
`Email` varchar(100) NOT NULL,
PRIMARY KEY (`UserId`)
);
CREATE TABLE `servicesData` (
`ServiceId` smallint unsigned NOT NULL AUTO_INCREMENT,
`Name` varchar(100) NOT NULL,
`Seller` varchar(100) NOT NULL,
`Price` float NOT NULL,
`Description` varchar(300) NOT NULL,
`PhoneNumber` varchar(100) NOT NULL,
`Email` varchar(100) NOT NULL,
`category` varchar(100) NOT NULL,
`image_url` varchar(300) NOT NULL,
PRIMARY KEY (`ServiceId`)
);
CREATE TABLE `giveawayData` (
`giveaway_id` smallint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`image_url` VARCHAR(255) NOT NULL,
`seller` varchar(100) NOT NULL,
`description` varchar(300) NOT NULL,
`time_posted` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`time_end` DATETIME NOT NULL,
`winnerId` INT,
PRIMARY KEY (`giveaway_id`)
);
CREATE TABLE giveawayEntreesData (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`giveaway_id` SMALLINT UNSIGNED NOT NULL,
`name` VARCHAR(255),
`user_id` INT NOT NULL,
`entree_time` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (giveaway_id) REFERENCES giveawayData(giveaway_id)
);