Attacks are now pending

This commit is contained in:
2019-05-29 04:35:53 +10:00
parent f700daeb25
commit 2aeb9e7e10
8 changed files with 180 additions and 14 deletions
+38
View File
@@ -54,4 +54,42 @@ CREATE TABLE IF NOT EXISTS profiles (
lastRecruitTime TIMESTAMP DEFAULT '2019-01-01 00:00:00',
CONSTRAINT FOREIGN KEY fk_accountId(accountId) REFERENCES accounts(id) ON UPDATE CASCADE ON DELETE CASCADE
);
#combat system
CREATE TABLE IF NOT EXISTS pendingCombat (
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE,
td TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
eventTime TIMESTAMP,
attackerId INTEGER UNSIGNED,
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 pastCombat (
id INTEGER UNSIGNED AUTO_INCREMENT PRIMARY KEY UNIQUE,
td TIMESTAMP DEFAULT CURRENT_TIMESTAMP(),
eventTime TIMESTAMP,
attackerId INTEGER UNSIGNED,
defenderId INTEGER UNSIGNED,
attackingUnits INTEGER UNSIGNED,
defindingUnits INTEGER UNSIGNED,
undefended BOOLEAN,
victor ENUM ('attacker', 'defender'),
spoilsGold INTEGER,
casualtiesVictor INTEGER,
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
);