diff --git a/Maps.hooks.php b/Maps.hooks.php index f812058f6..9aac0de5b 100644 --- a/Maps.hooks.php +++ b/Maps.hooks.php @@ -98,22 +98,20 @@ public static function onCanonicalNamespaces( array &$list ) { * * @since 3.0 * - * @global type $wgDBtype * @param DatabaseUpdater $updater * * @return true */ public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) { - global $wgDBtype; - - switch( $wgDBtype ) { + switch( $GLOBALS['wgDBtype'] ) { case 'mysql': case 'sqlite': - $sqlPath = dirname( __FILE__ ) . '/schema/MapsLayers.sql'; - break; - /** @ToDo: Support for Postgree SQL and others **/ + $updater->addExtensionTable( 'maps_layers', __DIR__ . '/schema/MapsLayers.sql' ); + break; + case 'postgres': + $updater->addExtensionTable( 'maps_layers', __DIR__ . '/schema/MapsLayers-postgres.sql' ); + break; } - $updater->addExtensionTable( 'maps_layers', $sqlPath ); return true; } diff --git a/schema/MapsLayers-postgres.sql b/schema/MapsLayers-postgres.sql new file mode 100644 index 000000000..271d4aaaf --- /dev/null +++ b/schema/MapsLayers-postgres.sql @@ -0,0 +1,10 @@ +BEGIN; + +CREATE TABLE maps_layers ( + layer_page_id INTEGER NOT NULL REFERENCES page(page_id) ON DELETE CASCADE, + layer_name VARCHAR(64) DEFAULT NULL, + layer_type VARCHAR(32) NOT NULL, + layer_data TEXT NOT NULL +) /*$wgDBTableOptions*/; + +COMMIT; \ No newline at end of file