PostgreSQL: Improve performance and squish bug.
[quassel.git] / src / core / SQL / PostgreSQL / 20 / upgrade_004_add_lastseenmsgid_constraint.sql
diff --git a/src/core/SQL/PostgreSQL/20/upgrade_004_add_lastseenmsgid_constraint.sql b/src/core/SQL/PostgreSQL/20/upgrade_004_add_lastseenmsgid_constraint.sql
new file mode 100644 (file)
index 0000000..da37927
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE buffer ADD CONSTRAINT badLastSeenMsgId CHECK (buffer.lastseenmsgid <= buffer.lastmsgid)