View Issue Details

IDProjectCategoryView StatusLast Update
0013210mantisbtdb postgresqlpublic2016-07-11 15:41
ReporterChris Kobrzak Assigned To 
PrioritylowSeveritytweakReproducibilityN/A
Status newResolutionopen 
Product Version1.2.6 
Summary0013210: Adding support for PostgreSQL schemas
Description

I've just installed MantisBT on my local computer choosing Postgres as the back-end. I've run into an issue with one of the installer's ALTER TABLE queries running against mantis_user_pref_table that was trying to change the redirect_delay boolean column to INTEGER but I managed to work around it (I'm going to log it a separate ticket at some point).

However, the issue with the installer is it doesn't seem to support PostgreSQL schemas (http://www.postgresql.org/docs/9.0/static/ddl-schemas.html ).
And if you'd like to use a schema that is different from the default "public" one, go ahead with the Mantis installer and once the set-up is complete, do the following:

1) change the name of your schema to, say, myschema; this can be done with the following query:
ALTER SCHEMA public RENAME TO myschema;

2) add the following line to config_inc.php:
$g_db_schema = 'myschema';

3) locate the db_connect method in core/database_api.php

4) find a piece of logic where the db_is_mysql() method is called (in my case this is line 102)

5) add the following else-if statement between MySQL and DB2 checks:

else if (db_is_pgsql() && $p_db_schema !== null && !is_blank( $p_db_schema ) ) {
db_query_bound( 'SET search_path TO \'' . $p_db_schema .'\' ' );
}

That's it. Your MantisBT instance is now setting the DB schema to whatever's been set in the config file.

I hope this helps.

Additional Information

Tested with PostgreSQL 9.0 and PHP 5.3.4 on OS X.

TagsNo tags attached.

Activities

grangeway

grangeway

2014-05-16 15:02

reporter   ~0040502

MantisBT currently supports Mysql and has support for other database engines.

The support for other databases is known to be problematic.

Having implemented the current database layer into Mantis 10 years ago, I'm currently working on replacing the current layer.

If you are interested in using Mantis with non-mysql databases - for example, Oracle, PGSQL or MSSQL, and would be willing to help out testing the new database layer, please drop me an email at paul@mantisforge.org

In the meantime, I'd advise running Mantis with Mysql Only to avoid issues.

Thanks
Paul

atrol

atrol

2014-06-16 15:38

developer   ~0040815

Reminder sent to: dregad, grangeway

Not sure, maybe this issue should be moved back to project mantis .
If so, grangeway could make a copy of it in project "Track DBAL replacement"