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

Change subject: Add nextSequenceValue() to support dbs like PostGres
......................................................................


Add nextSequenceValue() to support dbs like PostGres

Change-Id: I7af8391fc88d0336b83dba449f52709f309b6833
---
M includes/DbEchoBackend.php
M includes/DbEmailBatch.php
M model/Event.php
3 files changed, 19 insertions(+), 7 deletions(-)

Approvals:
  Matthias Mullie: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/DbEchoBackend.php b/includes/DbEchoBackend.php
index 32b2496..dc765f2 100644
--- a/includes/DbEchoBackend.php
+++ b/includes/DbEchoBackend.php
@@ -167,6 +167,10 @@
        public function createEvent( $row ) {
                $id = $this->dbw->nextSequenceValue( 'echo_event_id' );
 
+               if ( $id ) {
+                       $row['event_id'] = $id;
+               }
+
                $this->dbw->insert( 'echo_event', $row, __METHOD__ );
 
                if ( !$id ) {
diff --git a/includes/DbEmailBatch.php b/includes/DbEmailBatch.php
index f693344..9c15dc6 100644
--- a/includes/DbEmailBatch.php
+++ b/includes/DbEmailBatch.php
@@ -114,14 +114,23 @@
                }
 
                $dbw = MWEchoDbFactory::getDB( DB_MASTER );
+
+               $row = array(
+                       'eeb_user_id' => $userId,
+                       'eeb_event_id' => $eventId,
+                       'eeb_event_priority' => $priority,
+                       'eeb_event_hash' => $hash
+               );
+
+               $id = $dbw->nextSequenceValue( 'echo_email_batch_eeb_id' );
+
+               if ( $id ) {
+                       $row['eeb_id'] = $id;
+               }
+
                $dbw->insert(
                        'echo_email_batch',
-                       array(
-                               'eeb_user_id' => $userId,
-                               'eeb_event_id' => $eventId,
-                               'eeb_event_priority' => $priority,
-                               'eeb_event_hash' => $hash
-                       ),
+                       $row,
                        __METHOD__,
                        array( 'IGNORE' )
                );
diff --git a/model/Event.php b/model/Event.php
index f38e166..669cf07 100644
--- a/model/Event.php
+++ b/model/Event.php
@@ -136,7 +136,6 @@
                }
 
                $row = array(
-                       'event_id' => $this->id,
                        'event_type' => $this->type,
                        'event_variant' => $this->variant,
                );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7af8391fc88d0336b83dba449f52709f309b6833
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Lwelling <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to