jenkins-bot has submitted this change and it was merged.

Change subject: Database schema improvements (T102992)
......................................................................


Database schema improvements (T102992)

Change-Id: I32dacbde7aef28bf012ca90218d9fb3a7cd703a0
---
M includes/ConstraintRepository.php
M maintenance/UpdateTable.php
M sql/create_wbqc_constraints.sql
3 files changed, 8 insertions(+), 9 deletions(-)

Approvals:
  Tamslo: Looks good to me, approved
  Jonaskeutel: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/ConstraintRepository.php 
b/includes/ConstraintRepository.php
index 000de2c..df66a75 100644
--- a/includes/ConstraintRepository.php
+++ b/includes/ConstraintRepository.php
@@ -51,9 +51,6 @@
                );
 
                $db = wfGetDB( DB_MASTER );
-               $db->commit( __METHOD__, "flush" );
-               wfWaitForSlaves();
-
                return $db->insert( CONSTRAINT_TABLE, $accumulator );
        }
 
diff --git a/maintenance/UpdateTable.php b/maintenance/UpdateTable.php
index 8078776..d234411 100644
--- a/maintenance/UpdateTable.php
+++ b/maintenance/UpdateTable.php
@@ -46,11 +46,16 @@
        private function insertValues( $constraintRepo, $csvFile ) {
 
                $i = 0;
+               $db = wfGetDB( DB_MASTER );
                $accumulator = array();
                while ( true ) {
                        $data = fgetcsv( $csvFile );
                        if ( $data === false || ++$i % $this->mBatchSize === 0 
) {
                                $constraintRepo->insertBatch( $accumulator );
+
+                               $db->commit( __METHOD__, 'flush' );
+                               wfWaitForSlaves();
+
                                if ( !$this->isQuiet() ) {
                                        $this->output( "\r\033[K" );
                                        $this->output( "$i rows inserted" );
diff --git a/sql/create_wbqc_constraints.sql b/sql/create_wbqc_constraints.sql
index 7b371c1..18c4bb4 100755
--- a/sql/create_wbqc_constraints.sql
+++ b/sql/create_wbqc_constraints.sql
@@ -1,12 +1,9 @@
 CREATE TABLE IF NOT EXISTS /*_*/wbqc_constraints (
-  constraint_guid                VARCHAR(255)          PRIMARY KEY,
+  constraint_guid                VARBINARY(63)         PRIMARY KEY,
   pid                            INT(11)               NOT NULL,
-  constraint_type_qid          VARCHAR(255)    NOT NULL,
+  constraint_type_qid          VARBINARY(25)   NOT NULL,
   constraint_parameters                TEXT                          DEFAULT 
NULL
 ) /*$wgDBTableOptions*/;
 
 CREATE INDEX /*i*/wbqc_constraints_pid_index
-ON /*_*/wbqc_constraints (pid);
-
-CREATE INDEX /*i*/wbqc_constraints_constraint_type_qid_index
-ON /*_*/wbqc_constraints (constraint_type_qid);
\ No newline at end of file
+ON /*_*/wbqc_constraints (pid);
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/222722
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I32dacbde7aef28bf012ca90218d9fb3a7cd703a0
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: v1
Gerrit-Owner: Soeren.oldag <soeren_ol...@freenet.de>
Gerrit-Reviewer: Jonaskeutel <jonas.keu...@student.hpi.de>
Gerrit-Reviewer: Tamslo <tamaraslosa...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to