Support for PostgreSQL

My idea is:
Include support for PostgreSQL.

I think these groups of people would benefit from this idea:
All users who are already using PostgreSQL on their servers.

Why I think they would benefit from this idea:
If company has choosen to support one RDBMS, it already has invested in infrastructure, security rules etc. PostgreSQL is 4th popular RDBMS. Forcing companies that use it to introduce different RDBMS is huge blocker for adopting Mautic.

Any code or resources to support this idea:

Are you willing to work on this idea?:
I can help with testing

What skills and resources do you need to explore this further?
Support for PostgreSQL

1 Like

I’m really interested in this - as I’m evaluating Mautic to see if it would work. In particular being able to run Mautic on CoachroachDB is a very desirable feature. CoachroachDB is 100% PostgreSQL compatible.

Me too. I fully support this also. Would make Mautic more usable for those working in Python webapp world where Postgres is the go to.

How big a leap is it, beyond testing?

+1 for adding support for Postgres. I’m would be happy to test new features to ensure stability and reliability.

Many other companies use Postgres or Postgres-compatible database and would benefit from Mautic supporting Postgres as a database.

Hi everyone!

We see that many companies have a demand to work with PostgreSQL DBMS. Often this is due to company policy or the desire not to multiply the “zoo” of supported DBMS.

The community canceled a version of PosgreSQL some time ago because there weren’t enough resources to support it. We are ready to invest the time of our team to bring the backward compatibility back. In any case, we have already begun this work and will complete it. As a result of our work, the Mautic will be able to work on both MySQL and PostgreSQL.

We want our work to be useful to the Mautic community as well. We suggest making a public or hidden* mode of the PosgreSQL installation for those who need it. The basis of the DBMS will remain MySQL.

Our only request is not to write hard calls to MySQL in the main kernel code and to use ORM where it is possible.

Our main question is whether the community will support our PullRequest with the return of PostgreSQL backwards compatibility?

* For example, when passing a GET parameter, the option to select a parameter will open.

PostgreSQL support was dropped very early in the Mautic project lifespan. You nailed the reason. But it was not only because the developers have to test against 2 databases but also the testers which is still the biggest pain of the Mautic community to date. There is shortage of testers and now imagine they’ll have to test everything twice in 2 different environments. Adding another automated tests to GitHub Actions to run them on MySql, MariaDB and also on PostgreSQL would be quite simple. However, Mautic has only like 50% test coverage and many tests are unit, not functional. So it wouldn’t discover issues with database compatibility.

DBAL queries are used more and more as ORM is not performant enough. ORM is good to get projects started but it sucks when the data grow beyond certain level. So no, using ORM is not an option. You’d have to build an abstraction upon the repository classes and duplicate the repositories to support each database.

In my opinion the effort to build the support and maintain it is far greater than maintain a “zoo” of DBMS. Especially when Docker is around these days.

Colleagues, thanks for the answer!

Look, imagine a typical large enterprise corporation with a huge software structure. As a rule now in modern kubernetes corporations. Most do not use DB in kubernetes. For DB, raise a DB corporate failover cluster. And it’s easier to use clusters of the same type and not bloat the stack.

In our case, our client is exactly that. This is one of the world’s largest corporations with very strict requirements of architects that do not allow the stack to spread.

And in any case, we will have to port mautic to posgresql. However, we want the community to take advantage of the fruits of our work, for many corporations this may be relevant, as well as for us, we are not the first year in this market.
In addition, we still have a number of features that we want to share with the community.

We are considering an option
a) An attempt to offer the community to return support for posgreSQL, albeit in shadow mode (only those who wish use it)
b) Make a public fork of mautik in PosgtgreSQL. But for this, we need to make some changes to the main branch, just at least so that “mysqli” is not hard-wired scattered across all project files (it seems to be moveton even if you have 1 database).

Can you tell me which path would you recommend?

You are very welcome to implement the PostgreSQL support to Mautic. A few percent of the community members will be glad for that option for sure. It will be massive undertaking. So make sure you have a solid team of developers that you can spend several quarters working on this. Please be aware that all contributions must be well covered by tests. In this case where all will depend on database interaction, it will have to be functional tests.

at least so that “mysqli” is not hard-wired scattered across all project files

I don’t understand this. Are you talking about Mautic codebase? Can you share a link to at least 2 files with hard-wired “mysqli”? I can see only one which is in the installation step and is checked whether “function_exists” first.

The biggest problem that all Mautic developers face is lack of testers. Which is apparent when you check how many open PRs this project has. So please consider also bringing in a team of testers so the community can safely merge all the refactoring you’ll have to do.

1 Like

Can I chime in that if you were to make such a big change wouldnt it make sense to use GitHub - ClickHouse/ClickHouse: ClickHouse® is a free analytics DBMS for big data instead? Piwikpro uses this and it scales enormously. IF your going to bother then take it to the next level. Also you use Doctrine so maybe these would help:

or this:

Sorry it might be off topic but wanted to throw it out there but yeah it probably belongs in a different feature request thread.