Make the messagedb a bounded queue at 5000 msgs/device

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-08-17 20:39:48 -07:00
parent 2902ea6689
commit 8b941ddd33
1 changed files with 4 additions and 0 deletions

View File

@ -65,4 +65,8 @@
<dropNotNullConstraint tableName="messages" columnName="message"/>
</changeSet>
<changeSet id="3" author="moxie">
<sql>CREATE RULE bounded_message_queue AS ON INSERT TO messages DO ALSO DELETE FROM messages WHERE id IN (SELECT id FROM messages WHERE destination = NEW.destination AND destination_device = NEW.destination_device ORDER BY timestamp DESC OFFSET 5000);</sql>
</changeSet>
</databaseChangeLog>