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

Change subject: Add support for PostgreSQL database
......................................................................


Add support for PostgreSQL database

Bug: T112489
Change-Id: Ie50341f88e0c0d674d4ef9f16d627c5f2d138ec8
---
M InviteSignupHooks.php
A sql/invitesignup.pg.sql
2 files changed, 24 insertions(+), 1 deletion(-)

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



diff --git a/InviteSignupHooks.php b/InviteSignupHooks.php
index db7ede1..42d1468 100644
--- a/InviteSignupHooks.php
+++ b/InviteSignupHooks.php
@@ -63,6 +63,17 @@
 
        public static function onLoadExtensionSchemaUpdates( DatabaseUpdater 
$updater ) {
                $dir = __DIR__ . '/sql';
-               $updater->addExtensionTable( 'invitesignup', 
"$dir/invitesignup.sql" );
+               $type = $updater->getDB()->getType();
+
+               switch ( $type ) {
+               case 'mysql':
+                       $updater->addExtensionTable( 'invitesignup', 
"$dir/invitesignup.sql" );
+                       break;
+               case 'postgres':
+                       $updater->addExtensionTable( 'invitesignup', 
"$dir/invitesignup.pg.sql" );
+                       break;
+               default:
+                       throw new MWException( "InviteSignup does not support 
$type yet." );
+               }
        }
 }
diff --git a/sql/invitesignup.pg.sql b/sql/invitesignup.pg.sql
new file mode 100644
index 0000000..7691c26
--- /dev/null
+++ b/sql/invitesignup.pg.sql
@@ -0,0 +1,12 @@
+-- Invite signup signups
+CREATE TABLE /*$wgDBprefix*/invitesignup (
+  is_inviter INTEGER  NOT NULL,
+  is_invitee INTEGER,
+  is_email   BYTEA    NOT NULL,
+  is_when    BYTEA    NOT NULL,
+  is_used    BYTEA,
+  is_hash    BYTEA    NOT NULL,
+  is_groups  BYTEA,
+
+  PRIMARY KEY (is_hash)
+) /*$wgDBTableOptions*/;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie50341f88e0c0d674d4ef9f16d627c5f2d138ec8
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/InviteSignup
Gerrit-Branch: master
Gerrit-Owner: Yoonghm <[email protected]>
Gerrit-Reviewer: Aklapper <[email protected]>
Gerrit-Reviewer: MarkAHershberger <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Springle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to