This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
install.sql
97 lines (80 loc) · 4.03 KB
/
install.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
DROP TABLE IF EXISTS wcf1_user_jcoins_statement;
CREATE TABLE wcf1_user_jcoins_statement (
entryID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
userID INT(10) NOT NULL,
executedUserID INT(10),
time INT(10) NOT NULL DEFAULT 0,
reason VARCHAR(255) NOT NULL DEFAULT '',
link VARCHAR(255) NOT NULL DEFAULT '',
additionalData MEDIUMTEXT,
sum INT(10) NOT NULL DEFAULT 0,
isTrashed BOOLEAN NOT NULL DEFAULT 0,
isModTransfer BOOLEAN NOT NULL DEFAULT 0,
KEY user (userID),
KEY executedUser (executedUserID)
);
DROP TABLE IF EXISTS wcf1_user_group_premium;
CREATE TABLE wcf1_user_group_premium (
premiumGroupID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
groupID INT(10),
jCoins INT(10) NOT NULL DEFAULT 0,
period INT(10) NOT NULL DEFAULT 0,
isDisabled TINYINT(1) NOT NULL DEFAULT 0,
description MEDIUMTEXT NOT NULL,
KEY userGroup (groupID)
);
-- SHOP :)
DROP TABLE IF EXISTS wcf1_jcoins_shop_item_type;
CREATE TABLE wcf1_jcoins_shop_item_type (
itemTypeID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
identifer MEDIUMTEXT NOT NULL,
isMultiple BOOLEAN NOT NULL DEFAULT 1,
className MEDIUMTEXT NOT NULL,
packageID INT(10)
);
DROP TABLE IF EXISTS wcf1_jcoins_shop_item_type_parameter;
CREATE TABLE wcf1_jcoins_shop_item_type_parameter (
parameterID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
itemTypeID INT(10) NOT NULL,
name VARCHAR(30) NOT NULL,
regex VARCHAR(255),
type MEDIUMTEXT,
packageID INT(10)
);
DROP TABLE IF EXISTS wcf1_jcoins_shop_item;
CREATE TABLE wcf1_jcoins_shop_item (
itemID INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY,
itemType INT(10),
isDisabled BOOLEAN NOT NULL DEFAULT 0,
price INT(10) NOT NULL DEFAULT 0,
description MEDIUMTEXT NOT NULL,
name VARCHAR(255) NOT NULL DEFAULT '',
parseBBCodes BOOLEAN NOT NULL DEFAULT 1,
allowHTML BOOLEAN NOT NULL DEFAULT 0,
allowSmileys BOOLEAN NOT NULL DEFAULT 0,
showOrder INT(10)
);
DROP TABLE IF EXISTS wcf1_jcoins_shop_item_parameter;
CREATE TABLE wcf1_jcoins_shop_item_parameter (
itemID INT(10) NOT NULL,
parameterID INT(10),
value TEXT
);
DROP TABLE IF EXISTS wcf1_jcoins_shop_item_bought;
CREATE TABLE wcf1_jcoins_shop_item_bought (
itemID INT(10),
userID INT(10),
date INT(10)
);
ALTER TABLE wcf1_jcoins_shop_item ADD FOREIGN KEY (itemType) REFERENCES wcf1_jcoins_shop_item_type (itemTypeID) ON DELETE CASCADE;
ALTER TABLE wcf1_jcoins_shop_item_bought ADD FOREIGN KEY (itemID) REFERENCES wcf1_jcoins_shop_item (itemID) ON DELETE CASCADE;
ALTER TABLE wcf1_jcoins_shop_item_bought ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
ALTER TABLE wcf1_jcoins_shop_item_type_parameter ADD FOREIGN KEY (itemTypeID) REFERENCES wcf1_jcoins_shop_item_type (itemTypeID) ON DELETE CASCADE;
ALTER TABLE wcf1_jcoins_shop_item_parameter ADD FOREIGN KEY (parameterID) REFERENCES wcf1_jcoins_shop_item_type_parameter (parameterID) ON DELETE CASCADE;
ALTER TABLE wcf1_jcoins_shop_item_parameter ADD FOREIGN KEY (itemID) REFERENCES wcf1_jcoins_shop_item (itemID) ON DELETE CASCADE;
-- END SHOP
ALTER TABLE wcf1_user ADD jCoinsBalance INT(10) NOT NULL DEFAULT '0';
-- foreign keys
ALTER TABLE wcf1_user_jcoins_statement ADD FOREIGN KEY (executedUserID) REFERENCES wcf1_user (userID) ON DELETE SET NULL;
ALTER TABLE wcf1_user_jcoins_statement ADD FOREIGN KEY (userID) REFERENCES wcf1_user (userID) ON DELETE CASCADE;
ALTER TABLE wcf1_user_group_premium ADD FOREIGN KEY (groupID) REFERENCES wcf1_user_group (groupID) ON DELETE CASCADE;