r76397 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76396‎ | r76397 | r76398 >
Date:17:41, 9 November 2010
Author:ialex
Status:deferred
Tags:
Comment:
Moved testRunner[|.ora|.postgres].sql to [|oracle/|postgres/]archives/ so that they can be called through DatabaseBase::patchPath(), much simplier
Modified paths:
  • /trunk/phase3/maintenance/archives/patch-testrun.sql (added) (history)
  • /trunk/phase3/maintenance/oracle/archives/patch-testrun.sql (added) (history)
  • /trunk/phase3/maintenance/postgres/archives/patch-testrun.sql (added) (history)
  • /trunk/phase3/maintenance/testRunner.ora.sql (deleted) (history)
  • /trunk/phase3/maintenance/testRunner.postgres.sql (deleted) (history)
  • /trunk/phase3/maintenance/testRunner.sql (deleted) (history)
  • /trunk/phase3/maintenance/tests/testHelpers.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/testRunner.sql
@@ -1,35 +0,0 @@
2 -
3 -drop table if exists /*$wgDBprefix*/testitem;
4 -drop table if exists /*$wgDBprefix*/testrun;
5 -
6 -create table /*$wgDBprefix*/testrun (
7 - tr_id int not null auto_increment,
8 -
9 - tr_date char(14) binary,
10 - tr_mw_version blob,
11 - tr_php_version blob,
12 - tr_db_version blob,
13 - tr_uname blob,
14 -
15 - primary key (tr_id)
16 -) engine=InnoDB;
17 -
18 -create table /*$wgDBprefix*/testitem (
19 - ti_run int not null,
20 - ti_name varchar(255),
21 - ti_success bool,
22 -
23 - unique key (ti_run, ti_name),
24 - key (ti_run, ti_success),
25 -
26 - foreign key (ti_run) references /*$wgDBprefix*/testrun(tr_id)
27 - on delete cascade
28 -) engine=InnoDB;
Index: trunk/phase3/maintenance/testRunner.postgres.sql
@@ -1,30 +0,0 @@
2 -
3 -DROP TABLE IF EXISTS testitem;
4 -DROP TABLE IF EXISTS testrun;
5 -DROP SEQUENCE IF EXISTS testrun_id_seq;
6 -
7 -CREATE SEQUENCE testrun_id_seq;
8 -CREATE TABLE testrun (
9 - tr_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('testrun_id_seq'),
10 - tr_date TIMESTAMPTZ,
11 - tr_mw_version TEXT,
12 - tr_php_version TEXT,
13 - tr_db_version TEXT,
14 - tr_uname TEXT
15 -);
16 -
17 -CREATE TABLE testitem (
18 - ti_run INTEGER NOT NULL REFERENCES testrun(tr_id) ON DELETE CASCADE,
19 - ti_name TEXT NOT NULL,
20 - ti_success SMALLINT NOT NULL
21 -);
22 -CREATE UNIQUE INDEX testitem_uniq ON testitem(ti_run, ti_name);
Index: trunk/phase3/maintenance/testRunner.ora.sql
@@ -1,37 +0,0 @@
2 -define mw_prefix='{$wgDBprefix}';
3 -
4 -DROP TABLE &mw_prefix.testitem CASCADE CONSTRAINTS;
5 -DROP TABLE &mw_prefix.testrun CASCADE CONSTRAINTS;
6 -
7 -CREATE SEQUENCE testrun_tr_id_seq;
8 -CREATE TABLE &mw_prefix.testrun (
9 - tr_id NUMBER NOT NULL,
10 - tr_date DATE,
11 - tr_mw_version BLOB,
12 - tr_php_version BLOB,
13 - tr_db_version BLOB,
14 - tr_uname BLOB,
15 -);
16 -ALTER TABLE &mw_prefix.testrun ADD CONSTRAINT &mw_prefix.testrun_pk PRIMARY KEY (tr_id);
17 -CREATE OR REPLACE TRIGGER &mw_prefix.testrun_bir
18 -BEFORE UPDATE FOR EACH ROW
19 -ON &mw_prefix.testrun
20 -BEGIN
21 - SELECT testrun_tr_id_seq.NEXTVAL into :NEW.tr_id FROM dual;
22 -END;
23 -
24 -CREATE TABLE /*$wgDBprefix*/testitem (
25 - ti_run NUMBER NOT NULL REFERENCES &mw_prefix.testrun (tr_id) ON DELETE CASCADE,
26 - ti_name VARCHAR22(255),
27 - ti_success NUMBER(1)
28 -);
29 -CREATE UNIQUE INDEX &mw_prefix.testitem_u01 ON &mw_prefix.testitem (ti_run, ti_name);
30 -CREATE UNIQUE INDEX &mw_prefix.testitem_u01 ON &mw_prefix.testitem (ti_run, ti_success);
31 -
Index: trunk/phase3/maintenance/archives/patch-testrun.sql
@@ -0,0 +1,35 @@
 2+--
 3+-- Optional tables for parserTests recording mode
 4+-- With --record option, success data will be saved to these tables,
 5+-- and comparisons of what's changed from the previous run will be
 6+-- displayed at the end of each run.
 7+--
 8+-- These tables currently require MySQL 5 (or maybe 4.1?) for subselects.
 9+--
 10+
 11+drop table if exists /*$wgDBprefix*/testitem;
 12+drop table if exists /*$wgDBprefix*/testrun;
 13+
 14+create table /*$wgDBprefix*/testrun (
 15+ tr_id int not null auto_increment,
 16+
 17+ tr_date char(14) binary,
 18+ tr_mw_version blob,
 19+ tr_php_version blob,
 20+ tr_db_version blob,
 21+ tr_uname blob,
 22+
 23+ primary key (tr_id)
 24+) engine=InnoDB;
 25+
 26+create table /*$wgDBprefix*/testitem (
 27+ ti_run int not null,
 28+ ti_name varchar(255),
 29+ ti_success bool,
 30+
 31+ unique key (ti_run, ti_name),
 32+ key (ti_run, ti_success),
 33+
 34+ foreign key (ti_run) references /*$wgDBprefix*/testrun(tr_id)
 35+ on delete cascade
 36+) engine=InnoDB;
Property changes on: trunk/phase3/maintenance/archives/patch-testrun.sql
___________________________________________________________________
Added: svn:eol-style
137 + native
Index: trunk/phase3/maintenance/tests/testHelpers.inc
@@ -309,14 +309,7 @@
310310 or ! $this->db->tableExists( 'testitem' ) )
311311 {
312312 print "WARNING> `testrun` table not found in database. Trying to create table.\n";
313 - if ( $wgDBtype === 'postgres' ) {
314 - $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.postgres.sql' );
315 - } elseif ( $wgDBtype === 'oracle' ) {
316 - $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.ora.sql' );
317 - } else {
318 - $this->db->sourceFile( dirname( __FILE__ ) . '/testRunner.sql' );
319 - }
320 -
 313+ $this->db->sourceFile( $this->db->patchPath( 'patch-testrun.sql' ) );
321314 echo "OK, resuming.\n";
322315 }
323316
Index: trunk/phase3/maintenance/postgres/archives/patch-testrun.sql
@@ -0,0 +1,30 @@
 2+--
 3+-- Optional tables for parserTests recording mode
 4+-- With --record option, success data will be saved to these tables,
 5+-- and comparisons of what's changed from the previous run will be
 6+-- displayed at the end of each run.
 7+--
 8+-- This file is for the Postgres version of the tables
 9+--
 10+
 11+-- Note: "if exists" will not work on older versions of Postgres
 12+DROP TABLE IF EXISTS testitem;
 13+DROP TABLE IF EXISTS testrun;
 14+DROP SEQUENCE IF EXISTS testrun_id_seq;
 15+
 16+CREATE SEQUENCE testrun_id_seq;
 17+CREATE TABLE testrun (
 18+ tr_id INTEGER PRIMARY KEY NOT NULL DEFAULT nextval('testrun_id_seq'),
 19+ tr_date TIMESTAMPTZ,
 20+ tr_mw_version TEXT,
 21+ tr_php_version TEXT,
 22+ tr_db_version TEXT,
 23+ tr_uname TEXT
 24+);
 25+
 26+CREATE TABLE testitem (
 27+ ti_run INTEGER NOT NULL REFERENCES testrun(tr_id) ON DELETE CASCADE,
 28+ ti_name TEXT NOT NULL,
 29+ ti_success SMALLINT NOT NULL
 30+);
 31+CREATE UNIQUE INDEX testitem_uniq ON testitem(ti_run, ti_name);
Property changes on: trunk/phase3/maintenance/postgres/archives/patch-testrun.sql
___________________________________________________________________
Added: svn:eol-style
132 + native
Index: trunk/phase3/maintenance/oracle/archives/patch-testrun.sql
@@ -0,0 +1,37 @@
 2+--
 3+-- Optional tables for parserTests recording mode
 4+-- With --record option, success data will be saved to these tables,
 5+-- and comparisons of what's changed from the previous run will be
 6+-- displayed at the end of each run.
 7+--
 8+-- defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
 9+define mw_prefix='{$wgDBprefix}';
 10+
 11+DROP TABLE &mw_prefix.testitem CASCADE CONSTRAINTS;
 12+DROP TABLE &mw_prefix.testrun CASCADE CONSTRAINTS;
 13+
 14+CREATE SEQUENCE testrun_tr_id_seq;
 15+CREATE TABLE &mw_prefix.testrun (
 16+ tr_id NUMBER NOT NULL,
 17+ tr_date DATE,
 18+ tr_mw_version BLOB,
 19+ tr_php_version BLOB,
 20+ tr_db_version BLOB,
 21+ tr_uname BLOB,
 22+);
 23+ALTER TABLE &mw_prefix.testrun ADD CONSTRAINT &mw_prefix.testrun_pk PRIMARY KEY (tr_id);
 24+CREATE OR REPLACE TRIGGER &mw_prefix.testrun_bir
 25+BEFORE UPDATE FOR EACH ROW
 26+ON &mw_prefix.testrun
 27+BEGIN
 28+ SELECT testrun_tr_id_seq.NEXTVAL into :NEW.tr_id FROM dual;
 29+END;
 30+
 31+CREATE TABLE /*$wgDBprefix*/testitem (
 32+ ti_run NUMBER NOT NULL REFERENCES &mw_prefix.testrun (tr_id) ON DELETE CASCADE,
 33+ ti_name VARCHAR22(255),
 34+ ti_success NUMBER(1)
 35+);
 36+CREATE UNIQUE INDEX &mw_prefix.testitem_u01 ON &mw_prefix.testitem (ti_run, ti_name);
 37+CREATE UNIQUE INDEX &mw_prefix.testitem_u01 ON &mw_prefix.testitem (ti_run, ti_success);
 38+
Property changes on: trunk/phase3/maintenance/oracle/archives/patch-testrun.sql
___________________________________________________________________
Added: svn:eol-style
139 + native

Status & tagging log