Jjanes has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/132328

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

UploadWizard: Add support for PostgreSQL

The extension-specific database schema updater had MySQL-specific syntax
for the uw_campaigns table, so create an alternative update script for
PostgreSQL.

This allows the update.php script to complete successfully under
PostgreSQL when the UploadWizard extension is enabled.

The uw_campaigns table is only used in advanced cases.  The
correct behavior of the resulting table under PostgreSQL has not been
tested.

Bug: 64067
Change-Id: I48e91b9f17e7a3142a5ffe718b56848d1f90b7df
---
R UploadWizard.mysql.sql
A UploadWizard.postgres.sql
C UploadWizard.sqlite3.sql
M UploadWizardHooks.php
4 files changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/28/132328/1

diff --git a/UploadWizard.sql b/UploadWizard.mysql.sql
similarity index 100%
rename from UploadWizard.sql
rename to UploadWizard.mysql.sql
diff --git a/UploadWizard.postgres.sql b/UploadWizard.postgres.sql
new file mode 100644
index 0000000..f7125e2
--- /dev/null
+++ b/UploadWizard.postgres.sql
@@ -0,0 +1,17 @@
+-- MySQL version of the database schema for the Upload Wizard extension.
+-- Licence: GNU GPL v2+
+-- Author: Jeroen De Dauw < jeroended...@gmail.com >
+
+-- Upload wizard campaigns
+-- This is *not* the primary storage for campaigns.
+-- Just stores a copy of information that is already present in the
+-- appropriate wikipages, for easier indexing / querying
+CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/uw_campaigns (
+  campaign_id              SERIAL PRIMARY KEY  NOT NULL,
+  campaign_name            VARCHAR(255)        NOT NULL,
+  campaign_enabled         INTEGER             NOT NULL default '0'
+) /*$wgDBTableOptions*/;
+
+CREATE UNIQUE INDEX /*i*/uw_campaigns_name ON /*_*/uw_campaigns 
(campaign_name);
+-- Since we sort on campaign_id for pagination
+CREATE INDEX /*i*/uw_campaigns_enabled ON /*_*/uw_campaigns (campaign_enabled, 
campaign_id);
diff --git a/UploadWizard.sql b/UploadWizard.sqlite3.sql
similarity index 100%
copy from UploadWizard.sql
copy to UploadWizard.sqlite3.sql
diff --git a/UploadWizardHooks.php b/UploadWizardHooks.php
index 394b26d..688871d 100644
--- a/UploadWizardHooks.php
+++ b/UploadWizardHooks.php
@@ -534,7 +534,7 @@
         * @return true
         */
        public static function onSchemaUpdate( /* DatabaseUpdater */ $updater = 
null ) {
-               $updater->addExtensionTable( 'uw_campaigns', dirname( __FILE__ 
) . '/UploadWizard.sql' );
+               $updater->addExtensionTable( 'uw_campaigns', dirname( __FILE__ 
) . '/UploadWizard.' . $updater->getDB()->getType() . '.sql' );
                $updater->addExtensionUpdate( array(
                        'addIndex',
                        'uw_campaigns',

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48e91b9f17e7a3142a5ffe718b56848d1f90b7df
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Jjanes <jeff.ja...@gmail.com>

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

Reply via email to