-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_mysql.sql
More file actions
122 lines (108 loc) · 4.24 KB
/
setup_mysql.sql
File metadata and controls
122 lines (108 loc) · 4.24 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
-- ═══════════════════════════════════════════════════════
-- HELLCORE NETWORK — MySQL Setup Script
-- Run this in MySQL Workbench, phpMyAdmin, or terminal:
-- mysql -u root -p < setup_mysql.sql
-- ═══════════════════════════════════════════════════════
CREATE DATABASE IF NOT EXISTS hellcore CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE hellcore;
CREATE TABLE IF NOT EXISTS hc_users (
id INT AUTO_INCREMENT PRIMARY KEY,
email VARCHAR(200) UNIQUE NOT NULL,
username VARCHAR(50) UNIQUE NOT NULL,
mc_username VARCHAR(50) DEFAULT '',
password_hash VARCHAR(100) NOT NULL,
session_token VARCHAR(120),
role VARCHAR(30) DEFAULT 'player',
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS hc_ranks (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
gamemode VARCHAR(30) NOT NULL,
rank_name VARCHAR(30) DEFAULT 'default',
UNIQUE KEY uq (user_id, gamemode)
);
CREATE TABLE IF NOT EXISTS hc_economy (
user_id INT PRIMARY KEY,
server_gold INT DEFAULT 0,
server_iron INT DEFAULT 0
);
CREATE TABLE IF NOT EXISTS hc_stats (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
gamemode VARCHAR(30) NOT NULL,
kills INT DEFAULT 0,
deaths INT DEFAULT 0,
wins INT DEFAULT 0,
losses INT DEFAULT 0,
coins INT DEFAULT 0,
UNIQUE KEY uq (user_id, gamemode)
);
CREATE TABLE IF NOT EXISTS hc_inventory (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
item_type VARCHAR(30) DEFAULT 'rank',
item_name VARCHAR(80) NOT NULL,
gamemode VARCHAR(30) DEFAULT '',
gifted_by INT,
status VARCHAR(20) DEFAULT 'active',
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS hc_gifts (
id INT AUTO_INCREMENT PRIMARY KEY,
from_user_id INT NOT NULL,
to_username VARCHAR(50) NOT NULL,
item_type VARCHAR(30) DEFAULT 'rank',
item_name VARCHAR(80) NOT NULL,
gamemode VARCHAR(30) DEFAULT '',
status VARCHAR(20) DEFAULT 'pending',
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS hc_cart (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
item_id VARCHAR(60) NOT NULL,
item_name VARCHAR(80) NOT NULL,
item_price DOUBLE NOT NULL,
gamemode VARCHAR(30) DEFAULT ''
);
CREATE TABLE IF NOT EXISTS hc_forums (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(200) NOT NULL,
content TEXT NOT NULL,
author_id INT NOT NULL,
category VARCHAR(40) DEFAULT 'general',
views INT DEFAULT 0,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS hc_replies (
id INT AUTO_INCREMENT PRIMARY KEY,
forum_id INT NOT NULL,
author_id INT NOT NULL,
content TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS hc_tickets (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(200) NOT NULL,
category VARCHAR(40) DEFAULT 'general',
description TEXT NOT NULL,
author_id INT NOT NULL,
status VARCHAR(20) DEFAULT 'open',
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS hc_ticket_msgs (
id INT AUTO_INCREMENT PRIMARY KEY,
ticket_id INT NOT NULL,
author_id INT NOT NULL,
content TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- ═══════════════════════════════════════════════════════
-- OPTIONAL: Create a dedicated MySQL user for the app
-- (more secure than using root)
-- ═══════════════════════════════════════════════════════
-- CREATE USER 'hellcore'@'localhost' IDENTIFIED BY 'StrongPassword123!';
-- GRANT ALL PRIVILEGES ON hellcore.* TO 'hellcore'@'localhost';
-- FLUSH PRIVILEGES;
SELECT 'Hellcore database setup complete!' AS status;