* Added recompressTracked.php, the second part of the recompression project. Uses...
[lhc/web/wiklou.git] / maintenance / storage / blob_tracking.sql
1
2 -- Table for tracking blobs prior to recompression or similar maintenance operations
3
4 CREATE TABLE /*$wgDBprefix*/blob_tracking (
5 -- page.page_id
6 -- This may be zero for orphan or deleted text
7 bt_page integer not null,
8
9 -- revision.rev_id
10 -- This may be zero for orphan or deleted text
11 bt_rev_id integer not null,
12
13 -- text.old_id
14 bt_text_id integer not null,
15
16 -- The ES cluster
17 bt_cluster varbinary(255),
18
19 -- The ES blob ID
20 bt_blob_id integer not null,
21
22 -- The CGZ content hash, or null
23 bt_cgz_hash varbinary(255),
24
25 -- The URL this blob is to be moved to
26 bt_new_url varbinary(255),
27
28 -- True if the text table has been updated to point to bt_new_url
29 bt_moved bool not null default 0,
30
31 -- Primary key
32 -- Note that text_id is not unique due to null edits (protection, move)
33 -- moveTextRow(), commit(), trackOrphanText()
34 PRIMARY KEY (bt_text_id, bt_rev_id),
35
36 -- Sort by page for easy CGZ recompression
37 -- doAllPages(), doAllOrphans(), doPage(), finishIncompleteMoves()
38 KEY (bt_moved, bt_page, bt_text_id),
39
40 -- Key for determining the revisions using a given blob
41 -- Not used by any scripts yet
42 KEY (bt_cluster, bt_blob_id, bt_cgz_hash)
43
44 ) /*$wgDBTableOptions*/;
45
46 -- Tracking table for blob rows that aren't tracked by the text table
47 CREATE TABLE /*$wgDBprefix*/blob_orphans (
48 bo_cluster varbinary(255),
49 bo_blob_id integer not null,
50
51 PRIMARY KEY (bo_cluster, bo_blob_id)
52 ) /*$wgDBTableOptions*/;
53