# Migrate from PostgreSQL to MySQL

**Date:** 2026-08-14

## Context

The project originally selected PostgreSQL as its primary data store, using Prisma as the ORM with the `@prisma/adapter-pg` driver.

We discovered that our target deployment environment (cPanel) does not provide native support for PostgreSQL out of the box, offering MySQL/MariaDB instead. Deploying PostgreSQL in this environment would require manual workarounds, ongoing custom maintenance, and risk instability on a platform optimized for the LAMP stack.

## Decision

We are changing the primary data store from PostgreSQL to MySQL. 

To accomplish this:
1. We will update the `datasource` provider in `schema.prisma` to `mysql`.
2. We will remove the explicit Postgres driver adapters (`@prisma/adapter-pg` and `pg`) from our `package.json` and `PrismaService`.
3. We will revert to using Prisma's default built-in query engine for MySQL, removing unnecessary abstractions.
4. Existing Postgres-specific migrations will be discarded and replaced with a fresh baseline migration against the new MySQL database.

## Consequences

* **Positive**: The application can now be deployed seamlessly to standard cPanel hosting without custom database infrastructure.
* **Positive**: By dropping the explicit driver adapter, we reduce our dependency footprint and simplify the `PrismaService` initialization.
* **Negative**: Any existing data in the development Postgres database will be lost as we are wiping the migrations and starting fresh.
* **Negative**: We lose Postgres-specific features (like native JSONB operations, though MySQL's JSON type provides similar functionality for our current `payload` needs).