Fix SQLite patch-(page|template)links-fix-pk.sql column order
[lhc/web/wiklou.git] / maintenance / sqlite / archives / patch-slot-origin.sql
1 --
2 -- Replace slot_inherited with slot_origin.
3 --
4 -- NOTE: There is no release that has slot_inherited. This is only needed to transition between
5 -- snapshot versions of 1.30.
6 --
7 -- NOTE: No code that writes to the slots table was merge yet, the table is assumed to be empty.
8 --
9 BEGIN TRANSACTION;
10
11 DROP TABLE /*_*/slots;
12
13 CREATE TABLE /*_*/slots (
14
15 -- reference to rev_id
16 slot_revision_id bigint unsigned NOT NULL,
17
18 -- reference to role_id
19 slot_role_id smallint unsigned NOT NULL,
20
21 -- reference to content_id
22 slot_content_id bigint unsigned NOT NULL,
23
24 -- The revision ID of the revision that originated the slot's content.
25 -- To find revisions that changed slots, look for slot_origin = slot_revision_id.
26 slot_origin bigint unsigned NOT NULL,
27
28 PRIMARY KEY ( slot_revision_id, slot_role_id )
29 ) /*$wgDBTableOptions*/;
30
31 -- Index for finding revisions that modified a specific slot
32 CREATE INDEX /*i*/slot_revision_origin_role ON /*_*/slots (slot_revision_id, slot_origin, slot_role_id);
33
34 COMMIT TRANSACTION;