diff options
author | Brad Jorsch <bjorsch@wikimedia.org> | 2018-03-07 10:40:27 -0500 |
---|---|---|
committer | Brad Jorsch <bjorsch@wikimedia.org> | 2018-03-13 16:54:25 -0400 |
commit | 267af09d32ff4e4f4da751e83adf97c7022edfce (patch) | |
tree | beb58555737e616b650bfc187b4d6c98396fe823 /maintenance/oracle | |
parent | b4eb1feed05b505c55c522edfeb6e2806b7f5055 (diff) | |
download | mediawikicore-267af09d32ff4e4f4da751e83adf97c7022edfce.tar.gz mediawikicore-267af09d32ff4e4f4da751e83adf97c7022edfce.zip |
DB: Add img_description_id column
This begins the process of merging image_comment_temp into the image
table by adding the needed column. Iab5f5215 will adjust the code
to use it and to add the necessary migration script.
Note this patch puts the new schema change in the 1.30 section rather
than the 1.31 section. This allows Iab5f5215 to have migrateComments.php
migrate the comments directly to the new field instead of having to
populate and then depopulate the temporary table.
Bug: T188132
Change-Id: I2485c5a758bf03bb2b4991eea920abd9d0d30bda
Diffstat (limited to 'maintenance/oracle')
-rw-r--r-- | maintenance/oracle/archives/patch-image-img_description_id.sql | 7 | ||||
-rw-r--r-- | maintenance/oracle/tables.sql | 2 |
2 files changed, 9 insertions, 0 deletions
diff --git a/maintenance/oracle/archives/patch-image-img_description_id.sql b/maintenance/oracle/archives/patch-image-img_description_id.sql new file mode 100644 index 000000000000..5995b242814c --- /dev/null +++ b/maintenance/oracle/archives/patch-image-img_description_id.sql @@ -0,0 +1,7 @@ +-- +-- patch-image-img_description_id.sql +-- +-- T188132. Add `img_description_id` to the `image` table. + +ALTER TABLE &mw_prefix.image ADD ( img_description_id NUMBER DEFAULT 0 NOT NULL ); +ALTER TABLE &mw_prefix.image ADD CONSTRAINT &mw_prefix.oldimage_fk2 FOREIGN KEY (img_description_id) REFERENCES &mw_prefix."COMMENT"(comment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; diff --git a/maintenance/oracle/tables.sql b/maintenance/oracle/tables.sql index 110188d30037..b24e0fe22620 100644 --- a/maintenance/oracle/tables.sql +++ b/maintenance/oracle/tables.sql @@ -517,6 +517,7 @@ CREATE TABLE &mw_prefix.image ( img_major_mime VARCHAR2(32) DEFAULT 'unknown', img_minor_mime VARCHAR2(100) DEFAULT 'unknown', img_description VARCHAR2(255), + img_description_id NUMBER DEFAULT 0 NOT NULL, img_user NUMBER DEFAULT 0 NOT NULL, img_user_text VARCHAR2(255) NULL, img_actor NUMBER DEFAULT 0 NOT NULL, @@ -525,6 +526,7 @@ CREATE TABLE &mw_prefix.image ( ); ALTER TABLE &mw_prefix.image ADD CONSTRAINT &mw_prefix.image_pk PRIMARY KEY (img_name); ALTER TABLE &mw_prefix.image ADD CONSTRAINT &mw_prefix.image_fk1 FOREIGN KEY (img_user) REFERENCES &mw_prefix.mwuser(user_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED; +ALTER TABLE &mw_prefix.image ADD CONSTRAINT &mw_prefix.image_fk2 FOREIGN KEY (img_description_id) REFERENCES &mw_prefix."COMMENT"(comment_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED; CREATE INDEX &mw_prefix.image_i01 ON &mw_prefix.image (img_user_text,img_timestamp); CREATE INDEX &mw_prefix.image_i02 ON &mw_prefix.image (img_size); CREATE INDEX &mw_prefix.image_i03 ON &mw_prefix.image (img_timestamp); |