Thread:Extension talk:Maps/Creating maps layers table ... Database.php: Could not open file./reply (5)

Hi Jeroen,

I finally took the time to look at the code closely. I had hopes that you had a new version nearly out. You're welcome to submit this as a bug fix, assuming you approve it.


 * 1) Added a new case for 'postgres' in the function onLoadExtensionSchemaUpdates in Maps.hooks.php.
 * 2) Created a new SQL file '/schema/MapsLayers-postgres.sql'

Thanks again, Mary

/**        * This will setup database tables for layer functionality. *        * @since 3.0 *        * @global type $wgDBtype * @param DatabaseUpdater $updater *        * @return true */       public static function onLoadExtensionSchemaUpdates( DatabaseUpdater $updater ) { global $wgDBtype;

switch( $wgDBtype ) { case 'mysql': case 'sqlite': $sqlPath = dirname( __FILE__ ). '/schema/MapsLayers.sql'; break; case 'postgres': $sqlPath = dirname( __FILE__ ). '/schema/MapsLayers-postgres.sql'; break; /** @ToDo: Support for other SQL **/ }               $updater->addExtensionTable( 'maps_layers', $sqlPath );

return true; }



MapsLayers-postgres.sql

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;