disinclined.org
/
git
/
mudd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
61350d3
)
fix record dependencies
author
Dylan Lloyd
<dylan@dylansserver.com>
Fri, 4 Oct 2013 07:18:01 +0000
(07:18 +0000)
committer
Dylan Lloyd
<dylan@dylansserver.com>
Fri, 4 Oct 2013 07:18:01 +0000
(07:18 +0000)
db.sql
patch
|
blob
|
history
diff --git
a/db.sql
b/db.sql
index
cbc8b3c
..
23ccd13
100644
(file)
--- a/
db.sql
+++ b/
db.sql
@@
-29,15
+29,17
@@
CREATE TABLE `messages` (
`source` int,
`sent` timestamp default current_timestamp,
PRIMARY KEY (`id`),
`source` int,
`sent` timestamp default current_timestamp,
PRIMARY KEY (`id`),
- CONSTRAINT `origin` FOREIGN KEY (`source`) REFERENCES `players` (`id`),
- CONSTRAINT `addressable` FOREIGN KEY (`destination`) REFERENCES `players` (`id`),
+ CONSTRAINT `origin` FOREIGN KEY (`source`) REFERENCES `players` (`id`)
+ ON DELETE CASCADE,
+ CONSTRAINT `addressable` FOREIGN KEY (`destination`) REFERENCES `players` (`id`)
+ ON DELETE CASCADE,
CONSTRAINT `place` FOREIGN KEY (`room`) REFERENCES `rooms` (`id`)
);
CREATE EVENT `purge_inactive_players`
CONSTRAINT `place` FOREIGN KEY (`room`) REFERENCES `rooms` (`id`)
);
CREATE EVENT `purge_inactive_players`
- ON SCHEDULE EVERY 1 MINUTE
+ ON SCHEDULE EVERY 1 MINUTE
STARTS now()
DO DELETE FROM `players` WHERE `last_active` < now() - interval 5 minute;
CREATE EVENT `purge_old_messages`
DO DELETE FROM `players` WHERE `last_active` < now() - interval 5 minute;
CREATE EVENT `purge_old_messages`
- ON SCHEDULE EVERY 1 MINUTE
+ ON SCHEDULE EVERY 1 MINUTE
STARTS now()
DO DELETE FROM `messages` WHERE `sent` < now() - interval 5 minute;
DO DELETE FROM `messages` WHERE `sent` < now() - interval 5 minute;