· 8 years ago · Jul 01, 2018, 09:42 AM
1 g_bMySQL = true;
2 SQL_TVoid(g_dDatabase, "CREATE TABLE IF NOT EXISTS `store_players` (\
3 `id` int(11) NOT NULL AUTO_INCREMENT,\
4 `authid` varchar(32) NOT NULL,\
5 `name` varchar(64) NOT NULL,\
6 `credits` int(11) NOT NULL,\
7 `date_of_join` int(11) NOT NULL,\
8 `date_of_last_join` int(11) NOT NULL,\
9 PRIMARY KEY (`id`),\
10 UNIQUE KEY `id` (`id`),\
11 UNIQUE KEY `authid` (`authid`)\
12 ) ENGINE=InnoDB CHARSET=utf8mb4;");
13 SQL_TVoid(g_dDatabase, "CREATE TABLE IF NOT EXISTS `store_items` (\
14 `id` int(11) NOT NULL AUTO_INCREMENT,\
15 `player_id` int(11) NOT NULL,\
16 `type` varchar(16) NOT NULL,\
17 `unique_id` varchar(256) NOT NULL,\
18 `date_of_purchase` int(11) NOT NULL,\
19 `date_of_expiration` int(11) NOT NULL,\
20 PRIMARY KEY (`id`)\
21 ) ENGINE=InnoDB CHARSET=utf8mb4;");
22 SQL_TVoid(g_dDatabase, "CREATE TABLE IF NOT EXISTS `store_equipment` (\
23 `player_id` int(11) NOT NULL,\
24 `type` varchar(16) NOT NULL,\
25 `unique_id` varchar(256) NOT NULL,\
26 `slot` int(11) NOT NULL\
27 ) ENGINE=InnoDB CHARSET=utf8mb4;");
28 SQL_TVoid(g_dDatabase, "CREATE TABLE IF NOT EXISTS `store_logs` (\
29 `id` int(11) NOT NULL AUTO_INCREMENT,\
30 `player_id` int(11) NOT NULL,\
31 `credits` int(11) NOT NULL,\
32 `reason` varchar(256) NOT NULL,\
33 `date` int(11) NOT NULL,\
34 PRIMARY KEY (`id`)\
35 ) ENGINE=InnoDB CHARSET=utf8mb4;");
36 g_dDatabase.Query(SQLCallback_NoError, "ALTER TABLE store_items ADD COLUMN price_of_purchase int(11)");
37 char m_szQuery[512];
38 Format(m_szQuery, sizeof(m_szQuery), "CREATE TABLE IF NOT EXISTS `%s` (\
39 `id` int(11) NOT NULL AUTO_INCREMENT,\
40 `parent_id` int(11) NOT NULL DEFAULT '-1',\
41 `item_price` int(32) NOT NULL,\
42 `item_type` varchar(64) NOT NULL,\
43 `item_flag` varchar(64) NOT NULL,\
44 `item_name` varchar(64) NOT NULL,\
45 `additional_info` text NOT NULL,\
46 `item_status` tinyint(1) NOT NULL,\
47 `supported_game` varchar(64) NOT NULL,\
48 PRIMARY KEY (`id`)\
49 ) ENGINE=InnoDB CHARSET=utf8mb4;", g_eCvars[g_cvarItemsTable][sCache]);
50 SQL_TVoid(g_dDatabase, m_szQuery);