Merge "Fix usage of $wgDebugDumpSql"
[mediawiki.git] / maintenance / storage / blob_tracking.sql
blob6cac9a3836ae8f2e29bb5bf23b4d4e47182911ee
2 -- Table for tracking blobs prior to recompression or similar maintenance operations
4 CREATE TABLE /*$wgDBprefix*/blob_tracking (
5         -- page.page_id
6         -- This may be zero for orphan or deleted text
7         -- Note that this is for compression grouping only -- it doesn't need to be
8         -- accurate at the time recompressTracked is run. Operations such as a
9         -- delete/undelete cycle may make it inaccurate.
10         bt_page integer not null,
12         -- revision.rev_id
13         -- This may be zero for orphan or deleted text
14         -- Like bt_page, it does not need to be accurate when recompressTracked is run.
15         bt_rev_id integer not null,
17         -- text.old_id
18         bt_text_id integer not null,
20         -- The ES cluster
21         bt_cluster varbinary(255),
23         -- The ES blob ID
24         bt_blob_id integer not null,
26         -- The CGZ content hash, or null
27         bt_cgz_hash varbinary(255),
29         -- The URL this blob is to be moved to
30         bt_new_url varbinary(255),
32         -- True if the text table has been updated to point to bt_new_url
33         bt_moved bool not null default 0,
35         -- Primary key
36         -- Note that text_id is not unique due to null edits (protection, move)
37         -- moveTextRow(), commit(), trackOrphanText()
38         PRIMARY KEY (bt_text_id, bt_rev_id),
40         -- Sort by page for easy CGZ recompression
41         -- doAllPages(), doAllOrphans(), doPage(), finishIncompleteMoves()
42         KEY (bt_moved, bt_page, bt_text_id),
44         -- Key for determining the revisions using a given blob
45         -- Not used by any scripts yet
46         KEY (bt_cluster, bt_blob_id, bt_cgz_hash)
48 ) /*$wgDBTableOptions*/;
50 -- Tracking table for blob rows that aren't tracked by the text table
51 CREATE TABLE /*$wgDBprefix*/blob_orphans (
52         bo_cluster varbinary(255),
53         bo_blob_id integer not null,
55         PRIMARY KEY (bo_cluster, bo_blob_id)
56 ) /*$wgDBTableOptions*/;