Began work on spying code

This commit is contained in:
2019-06-04 13:03:25 +10:00
parent e248003478
commit eb9c42ca56
14 changed files with 215 additions and 37 deletions
+51 -1
View File
@@ -115,6 +115,41 @@ CREATE TABLE IF NOT EXISTS pastCombat (
CONSTRAINT FOREIGN KEY fk_defenderId(defenderId) REFERENCES accounts(id) ON UPDATE CASCADE ON DELETE CASCADE
);
#spying system
CREATE TABLE IF NOT EXISTS pendingSpying (
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE,
td TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
eventTime TIMESTAMP,
attackerId INTEGER UNSIGNED UNIQUE,
defenderId INTEGER UNSIGNED,
attackingUnits INTEGER UNSIGNED,
CONSTRAINT FOREIGN KEY fk_attackerId(attackerId) REFERENCES accounts(id) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT FOREIGN KEY fk_defenderId(defenderId) REFERENCES accounts(id) ON UPDATE CASCADE ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS pastSpying (
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE,
td TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
eventTime TIMESTAMP,
attackerId INTEGER UNSIGNED,
defenderId INTEGER UNSIGNED,
attackingUnits INTEGER UNSIGNED,
success ENUM ('success', 'failure'),
spoilsGold INTEGER,
/* check the table "equipmentStolen" for a list of equipment stolen */
CONSTRAINT FOREIGN KEY fk_attackerId(attackerId) REFERENCES accounts(id) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT FOREIGN KEY fk_defenderId(defenderId) REFERENCES accounts(id) ON UPDATE CASCADE ON DELETE CASCADE
);
#equipment system
CREATE TABLE IF NOT EXISTS equipment (
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE,
@@ -128,4 +163,19 @@ CREATE TABLE IF NOT EXISTS equipment (
type VARCHAR(50),
CONSTRAINT FOREIGN KEY fk_accountId(accountId) REFERENCES accounts(id) ON UPDATE CASCADE ON DELETE CASCADE
);
);
CREATE TABLE IF NOT EXISTS equipmentStolen (
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE,
td TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
pastSpyingId INTEGER UNSIGNED,
name VARCHAR(50),
quantity INTEGER,
type VARCHAR(50),
CONSTRAINT FOREIGN KEY fk_pastSpyingId(pastSpyingId) REFERENCES pastSpying(id) ON UPDATE CASCADE ON DELETE CASCADE
);