Index: appengine/monorail/sql/framework.sql |
diff --git a/appengine/monorail/sql/framework.sql b/appengine/monorail/sql/framework.sql |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cfe1c31bc81e0bf2ba4dece2a8b5a449cfc9f8ba |
--- /dev/null |
+++ b/appengine/monorail/sql/framework.sql |
@@ -0,0 +1,36 @@ |
+-- Copyright 2016 The Chromium Authors. All Rights Reserved. |
+-- |
+-- Use of this source code is governed by a BSD-style |
+-- license that can be found in the LICENSE file or at |
+-- https://developers.google.com/open-source/licenses/bsd |
+ |
+ |
+-- Create app framework tables in the monorail DB. |
+ |
+ALTER DATABASE monorail CHARACTER SET = utf8 COLLATE = utf8_unicode_ci; |
+ |
+-- This table allows frontends to selectively invalidate their RAM caches. |
+-- On each incoming request, the frontend queries this table to get all rows |
+-- that are newer than the last row that it saw. Then it processes each such |
+-- row by dropping entries from its RAM caches, and remembers the new highest |
+-- timestep that it has seen. |
+CREATE TABLE Invalidate ( |
+ -- The time at which the invalidation took effect, by that time new data |
+ -- should be available to retrieve to fill local caches as needed. |
+ -- This is not a clock value, it is just an integer that counts up by one |
+ -- on each change. |
+ timestep BIGINT NOT NULL AUTO_INCREMENT, |
+ |
+ -- Which kind of entity was invalidated? Each kind is broad, e.g., |
+ -- invalidating a project also invalidates all issue tracker config within |
+ -- that project. But, they do not nest. E.g., invalidating a project does |
+ -- not invalidate all issues in the project. |
+ kind enum('user', 'project', 'issue', 'issue_id') NOT NULL, |
+ |
+ -- Which cache entry should be invalidated? Special value 0 indicates |
+ -- that all entries should be invalidated. |
+ cache_key INT UNSIGNED, |
+ |
+ INDEX (timestep) |
+) ENGINE=INNODB; |
+ |