Last change
on this file since 53643ca was 53643ca, checked in by Dmitry Portnoy <dmp1488@…>, 10 years ago |
Server loads user profile and game history info from the database, saves game history to the db after every game, and uses a lua settings file to load db settings
|
-
Property mode
set to
100644
|
File size:
898 bytes
|
Line | |
---|
1 | SQL statements for creating the db tables are stored here
|
---|
2 |
|
---|
3 | CREATE TABLE users(
|
---|
4 | id INT NOT NULL AUTO_INCREMENT,
|
---|
5 | wins INT NOT NULL DEFAULT 0,
|
---|
6 | losses INT NOT NULL DEFAULT 0
|
---|
7 | );
|
---|
8 |
|
---|
9 | CREATE TABLE `users` (
|
---|
10 | id INT NOT NULL AUTO_INCREMENT,
|
---|
11 | name varchar(64) NOT NULL,
|
---|
12 | password binary(60) NOT NULL,
|
---|
13 | class INT unsigned DEFAULT NULL,
|
---|
14 | level INT unsigned NOT NULL DEFAULT 0,
|
---|
15 | experience INT unsigned NOT NULL DEFAULT 0,
|
---|
16 | honor INT NOT NULL DEFAULT 0,
|
---|
17 | wins INT NOT NULL DEFAULT 0,
|
---|
18 | losses INT NOT NULL DEFAULT 0,
|
---|
19 | PRIMARY KEY (id),
|
---|
20 | UNIQUE KEY name (name)
|
---|
21 | }
|
---|
22 |
|
---|
23 |
|
---|
24 | CREATE TABLE gameHistory (
|
---|
25 | id INT NOT NULL AUTO_INCREMENT,
|
---|
26 | user_id INT NOT NULL,
|
---|
27 | user_team INT NOT NULL,
|
---|
28 | red_score INT NOT NULL,
|
---|
29 | blue_score INT NOT NULL,
|
---|
30 | PRIMARY KEY (id),
|
---|
31 | CONSTRAINT fk_users FOREIGN KEY
|
---|
32 | fki_users (user_id)
|
---|
33 | REFERENCES users (id)
|
---|
34 | ON DELETE CASCADE
|
---|
35 | ON UPDATE CASCADE
|
---|
36 | );
|
---|
Note:
See
TracBrowser
for help on using the repository browser.