mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-22 05:27:19 +00:00
updated initial migration
Made it so people wont accidentally wipe their database if 0_initial.sql is ever run again
This commit is contained in:
parent
3900267fed
commit
77c6350f03
@ -1,5 +1,4 @@
|
|||||||
DROP TABLE IF EXISTS accounts;
|
CREATE TABLE IF NOT EXISTS accounts (
|
||||||
CREATE TABLE accounts (
|
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
name VARCHAR(35) NOT NULL UNIQUE,
|
name VARCHAR(35) NOT NULL UNIQUE,
|
||||||
password TEXT NOT NULL,
|
password TEXT NOT NULL,
|
||||||
@ -11,8 +10,7 @@ CREATE TABLE accounts (
|
|||||||
mute_expire BIGINT UNSIGNED NOT NULL DEFAULT 0
|
mute_expire BIGINT UNSIGNED NOT NULL DEFAULT 0
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS charinfo;
|
CREATE TABLE IF NOT EXISTS charinfo (
|
||||||
CREATE TABLE charinfo (
|
|
||||||
id BIGINT NOT NULL PRIMARY KEY,
|
id BIGINT NOT NULL PRIMARY KEY,
|
||||||
account_id INT NOT NULL REFERENCES accounts(id),
|
account_id INT NOT NULL REFERENCES accounts(id),
|
||||||
name VARCHAR(35) NOT NULL,
|
name VARCHAR(35) NOT NULL,
|
||||||
@ -23,21 +21,18 @@ CREATE TABLE charinfo (
|
|||||||
permission_map BIGINT UNSIGNED NOT NULL DEFAULT 0
|
permission_map BIGINT UNSIGNED NOT NULL DEFAULT 0
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS charxml;
|
CREATE TABLE IF NOT EXISTS charxml (
|
||||||
CREATE TABLE charxml (
|
|
||||||
id BIGINT NOT NULL PRIMARY KEY REFERENCES charinfo(id),
|
id BIGINT NOT NULL PRIMARY KEY REFERENCES charinfo(id),
|
||||||
xml_data LONGTEXT NOT NULL
|
xml_data LONGTEXT NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS command_log;
|
CREATE TABLE IF NOT EXISTS command_log (
|
||||||
CREATE TABLE command_log (
|
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
character_id BIGINT NOT NULL REFERENCES charinfo(id),
|
character_id BIGINT NOT NULL REFERENCES charinfo(id),
|
||||||
command VARCHAR(256) NOT NULL
|
command VARCHAR(256) NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS friends;
|
CREATE TABLE IF NOT EXISTS friends (
|
||||||
CREATE TABLE friends (
|
|
||||||
player_id BIGINT NOT NULL REFERENCES charinfo(id),
|
player_id BIGINT NOT NULL REFERENCES charinfo(id),
|
||||||
friend_id BIGINT NOT NULL REFERENCES charinfo(id),
|
friend_id BIGINT NOT NULL REFERENCES charinfo(id),
|
||||||
best_friend BOOLEAN NOT NULL DEFAULT FALSE,
|
best_friend BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
@ -45,8 +40,7 @@ CREATE TABLE friends (
|
|||||||
PRIMARY KEY (player_id, friend_id)
|
PRIMARY KEY (player_id, friend_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS leaderboard;
|
CREATE TABLE IF NOT EXISTS leaderboard (
|
||||||
CREATE TABLE leaderboard (
|
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
game_id INT UNSIGNED NOT NULL DEFAULT 0,
|
game_id INT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
last_played TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
|
last_played TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(),
|
||||||
@ -55,8 +49,7 @@ CREATE TABLE leaderboard (
|
|||||||
score BIGINT UNSIGNED NOT NULL DEFAULT 0
|
score BIGINT UNSIGNED NOT NULL DEFAULT 0
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS mail;
|
CREATE TABLE IF NOT EXISTS mail (
|
||||||
CREATE TABLE mail (
|
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
sender_id INT NOT NULL DEFAULT 0,
|
sender_id INT NOT NULL DEFAULT 0,
|
||||||
sender_name VARCHAR(35) NOT NULL DEFAULT '',
|
sender_name VARCHAR(35) NOT NULL DEFAULT '',
|
||||||
@ -72,20 +65,17 @@ CREATE TABLE mail (
|
|||||||
was_read BOOLEAN NOT NULL DEFAULT FALSE
|
was_read BOOLEAN NOT NULL DEFAULT FALSE
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS object_id_tracker;
|
CREATE TABLE IF NOT EXISTS object_id_tracker (
|
||||||
CREATE TABLE object_id_tracker (
|
|
||||||
last_object_id BIGINT UNSIGNED NOT NULL DEFAULT 0 PRIMARY KEY
|
last_object_id BIGINT UNSIGNED NOT NULL DEFAULT 0 PRIMARY KEY
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS pet_names;
|
CREATE TABLE IF NOT EXISTS pet_names (
|
||||||
CREATE TABLE pet_names (
|
|
||||||
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
pet_name TEXT NOT NULL,
|
pet_name TEXT NOT NULL,
|
||||||
approved INT UNSIGNED NOT NULL
|
approved INT UNSIGNED NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS play_keys;
|
CREATE TABLE IF NOT EXISTS play_keys (
|
||||||
CREATE TABLE play_keys (
|
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
key_string CHAR(19) NOT NULL UNIQUE,
|
key_string CHAR(19) NOT NULL UNIQUE,
|
||||||
key_uses INT NOT NULL DEFAULT 1,
|
key_uses INT NOT NULL DEFAULT 1,
|
||||||
@ -93,8 +83,7 @@ CREATE TABLE play_keys (
|
|||||||
active BOOLEAN NOT NULL DEFAULT TRUE
|
active BOOLEAN NOT NULL DEFAULT TRUE
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS properties;
|
CREATE TABLE IF NOT EXISTS properties (
|
||||||
CREATE TABLE properties (
|
|
||||||
id BIGINT NOT NULL PRIMARY KEY,
|
id BIGINT NOT NULL PRIMARY KEY,
|
||||||
owner_id BIGINT NOT NULL REFERENCES charinfo(id),
|
owner_id BIGINT NOT NULL REFERENCES charinfo(id),
|
||||||
template_id INT UNSIGNED NOT NULL,
|
template_id INT UNSIGNED NOT NULL,
|
||||||
@ -112,8 +101,7 @@ CREATE TABLE properties (
|
|||||||
zone_id INT NOT NULL
|
zone_id INT NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS ugc;
|
CREATE TABLE IF NOT EXISTS ugc (
|
||||||
CREATE TABLE ugc (
|
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
account_id INT NOT NULL REFERENCES accounts(id),
|
account_id INT NOT NULL REFERENCES accounts(id),
|
||||||
character_id BIGINT NOT NULL REFERENCES charinfo(id),
|
character_id BIGINT NOT NULL REFERENCES charinfo(id),
|
||||||
@ -123,8 +111,7 @@ CREATE TABLE ugc (
|
|||||||
filename TEXT NOT NULL DEFAULT ('')
|
filename TEXT NOT NULL DEFAULT ('')
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS properties_contents;
|
CREATE TABLE IF NOT EXISTS properties_contents (
|
||||||
CREATE TABLE properties_contents (
|
|
||||||
id BIGINT NOT NULL PRIMARY KEY,
|
id BIGINT NOT NULL PRIMARY KEY,
|
||||||
property_id BIGINT NOT NULL REFERENCES properties(id),
|
property_id BIGINT NOT NULL REFERENCES properties(id),
|
||||||
ugc_id INT NULL REFERENCES ugc(id),
|
ugc_id INT NULL REFERENCES ugc(id),
|
||||||
@ -138,8 +125,7 @@ CREATE TABLE properties_contents (
|
|||||||
rw FLOAT NOT NULL
|
rw FLOAT NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS activity_log;
|
CREATE TABLE IF NOT EXISTS activity_log (
|
||||||
CREATE TABLE activity_log (
|
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
character_id BIGINT NOT NULL REFERENCES charinfo(id),
|
character_id BIGINT NOT NULL REFERENCES charinfo(id),
|
||||||
activity INT NOT NULL,
|
activity INT NOT NULL,
|
||||||
@ -147,8 +133,7 @@ CREATE TABLE activity_log (
|
|||||||
map_id INT NOT NULL
|
map_id INT NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS bug_reports;
|
CREATE TABLE IF NOT EXISTS bug_reports (
|
||||||
CREATE TABLE bug_reports (
|
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
body TEXT NOT NULL,
|
body TEXT NOT NULL,
|
||||||
client_version TEXT NOT NULL,
|
client_version TEXT NOT NULL,
|
||||||
@ -157,8 +142,7 @@ CREATE TABLE bug_reports (
|
|||||||
submitted TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP()
|
submitted TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP()
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TABLE IF EXISTS servers;
|
CREATE TABLE IF NOT EXISTS servers (
|
||||||
CREATE TABLE servers (
|
|
||||||
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
ip TEXT NOT NULL,
|
ip TEXT NOT NULL,
|
||||||
|
Loading…
Reference in New Issue
Block a user