# Mautic 5 Migration Issue – Internal Server Error & Failed Database Migration

**URL:** <https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930>\
**Category:** Mautic 5 Install/Upgrade Support\
**Created:** [February 4, 2025, 9:37pm UTC](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930 "2025-02-04T21:37:48Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [February 6, 2025, 3:10pm UTC](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930/21 "2025-02-06T15:10:15Z")

</div>

| — | — | — | — |  
route=/table/structure/change&change\_column=1&field=properties&db=mauticdb&table=form\_designer)|(DC2Type:json\_array)

---

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [February 6, 2025, 3:13pm UTC](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930/22 "2025-02-06T15:13:38Z")

</div>

I will try this now,

---

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [February 6, 2025, 3:29pm UTC](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930/23 "2025-02-06T15:29:45Z")

</div>

I exported db from M4 and ran the sed command you suggested then imported the db into M5.

Here the result after I ran migration command

What did I do wrong or missed?

Thank you

```auto
agwm-mas@testcpserver:~/htdocs$ php bin/console doctrine:migrations:migrate --no-interaction
[2025-02-06 16:25:34]
[2025-02-06 16:25:34]
[2025-02-06 16:25:34] [WARNING] You have 47 previously executed migrations in the database that are
[2025-02-06 16:25:34] not registered migrations.
[2025-02-06 16:25:34]
[2025-02-06 16:25:34]
[2025-02-06 16:25:34] >> 2022-03-16 22:54:32 (20180508202930)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:32 (20180702014364)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:32 (20180702014365)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:33 (20180821144204)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:33 (20180921144421)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:33 (20181111095447)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:33 (20190704154940)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:33 (20190724110039)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:33 (20191017140848)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:34 (20191126093923)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:34 (20191206113956)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:34 (20191219155630)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:34 (20200211095409)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:34 (20200212141530)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:34 (20200220172041)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:34 (20200227110431)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:34 (20200302164801)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:34 (20200331160919)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:35 (20200409102100)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:35 (20200422144300)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:35 (20200507122854)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:35 (20200729170800)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:35 (20200805185714)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:35 (20200810153131)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:35 (20200812180900)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:35 (20200815153711)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20200924080139)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201015084627)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201102120710)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201102133546)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201105120328)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201120122846)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201123070813)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201125155904)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201130201631)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201207114926)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201207140911)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20201228041109)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:36 (20210104171005)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:37 (20210203143600)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:37 (20210223174702)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:37 (20210502162314)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:37 (20210520100503)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:37 (20210609191822)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:37 (20210614151138)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:37 (20210623071326)
[2025-02-06 16:25:34] >> 2022-03-16 22:54:37 (20220111202917)
[2025-02-06 16:25:34] [notice] Migrating up to Mautic\Migrations\Versionzz20230929183000
[error] Migration Mautic\Migrations\Version20190326190241 failed during Pre-Checks. Error: "Unknown column type "json_array" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information."

In Exception.php line 115:

  Unknown column type "json_array" requested. Any Doctrine type that you use
  has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get
   a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(
  ). If this error occurs during database introspection then you might have f
  orgotten to register all database types for a Doctrine Type. Use AbstractPl
  atform#registerDoctrineTypeMapping() or have your custom types implement Ty
  pe#getMappedDatabaseTypes(). If the type name is empty you might have a pro
  blem with the cache or forgot some mapping information.

```

---

<div class="post-metadata">

**Author:** ![aymen](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/aymen/32/13647_2.png) [@aymen](https://forum.mautic.org/u/aymen)\
**Post date:** [February 6, 2025, 3:35pm UTC](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930/24 "2025-02-06T15:35:04Z")

</div>

the column type still “json\_array” make sure you run properly

`sed -i 's/\bjson_array\b/json/g' mautic_backup.sql`

try to run migration `/bin/console doctrine:migrations:migrate --no-interaction --dry-run `

after that it may appear that some tables already exist, remove them from the DB and run the migration again then clear the cash.

---

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [February 6, 2025, 3:41pm UTC](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930/25 "2025-02-06T15:41:18Z")

</div>

I ran the following command on my Mac:

```auto
sed -i '.bak' 's/\bjson_array\b/json/g' mauticdb.sql

```

On macOS, the -i flag (for in-place editing) requires a backup file extension. That’s why I added **.bak** , which creates a backup of the original file before making changes.

Then imported it back into an empty database and ran the mirgation again where it seem to produce the same error again.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [February 6, 2025, 3:41pm UTC](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930/26 "2025-02-06T15:41:32Z")

</div>

sed-ing is also fine.  
I would try:

`ALTER TABLE form_designer MODIFY COLUMN properties longtext COLLATE utf8mb4_unicode_ci COMMENT "DC2Type:json)";`

---

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [February 6, 2025, 3:42pm UTC](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930/27 "2025-02-06T15:42:35Z")

</div>

```auto
agwm-mas@testcpserver:~/htdocs$ php bin/console doctrine:migrations:migrate --no-interaction --dry-run
[2025-02-06 16:42:09]
[2025-02-06 16:42:09]
[2025-02-06 16:42:09] [WARNING] You have 47 previously executed migrations in the database that are
[2025-02-06 16:42:09] not registered migrations.
[2025-02-06 16:42:09]
[2025-02-06 16:42:09]
[2025-02-06 16:42:09] >> 2022-03-16 22:54:32 (20180508202930)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:32 (20180702014364)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:32 (20180702014365)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:33 (20180821144204)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:33 (20180921144421)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:33 (20181111095447)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:33 (20190704154940)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:33 (20190724110039)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:33 (20191017140848)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:34 (20191126093923)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:34 (20191206113956)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:34 (20191219155630)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:34 (20200211095409)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:34 (20200212141530)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:34 (20200220172041)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:34 (20200227110431)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:34 (20200302164801)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:34 (20200331160919)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:35 (20200409102100)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:35 (20200422144300)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:35 (20200507122854)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:35 (20200729170800)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:35 (20200805185714)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:35 (20200810153131)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:35 (20200812180900)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:35 (20200815153711)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20200924080139)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201015084627)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201102120710)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201102133546)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201105120328)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201120122846)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201123070813)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201125155904)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201130201631)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201207114926)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201207140911)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20201228041109)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:36 (20210104171005)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:37 (20210203143600)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:37 (20210223174702)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:37 (20210502162314)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:37 (20210520100503)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:37 (20210609191822)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:37 (20210614151138)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:37 (20210623071326)
[2025-02-06 16:42:09] >> 2022-03-16 22:54:37 (20220111202917)
[2025-02-06 16:42:09] [notice] Migrating (dry-run) up to Mautic\Migrations\Versionzz20230929183000
[error] Migration Mautic\Migrations\Version20190326190241 failed during Pre-Checks. Error: "Unknown column type "json_array" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgotten to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information."

In Exception.php line 115:

  Unknown column type "json_array" requested. Any Doctrine type that you use
  has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get
   a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(
  ). If this error occurs during database introspection then you might have f
  orgotten to register all database types for a Doctrine Type. Use AbstractPl
  atform#registerDoctrineTypeMapping() or have your custom types implement Ty
  pe#getMappedDatabaseTypes(). If the type name is empty you might have a pro
  blem with the cache or forgot some mapping information.

doctrine:migrations:migrate [--write-sql [WRITE-SQL]] [--dry-run] [--query-time] [--allow-no-migration] [--all-or-nothing [ALL-OR-NOTHING]] [--no-all-or-nothing] [--configuration CONFIGURATION] [--em EM] [--conn CONN] [--] [<version>]

agwm-mas@testcpserver:~/htdocs$

```

---

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [February 6, 2025, 3:47pm UTC](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930/28 "2025-02-06T15:47:48Z")

</div>

That seem to fix it.

So when I am ready to apply this on a production copy, I would need to delete all old plugs or at least upgrade it then do a dump / import and run ALTER TABLE and that should get my db upgraded to M5.

Thank you

---

<div class="post-metadata">

**Author:** ![techbill](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/techbill/32/8325_2.png) [@techbill](https://forum.mautic.org/u/techbill)\
**Post date:** [February 6, 2025, 3:53pm UTC](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930/29 "2025-02-06T15:53:35Z")

</div>

Since it a separate issue so I decided to create a new topic on the statistic issue over at [Do Mautic 4 statistics transfer to Mautic 5 after an upgrade?](https://forum.mautic.org/t/do-mautic-4-statistics-transfer-to-mautic-5-after-an-upgrade/34957)

Thanks for helping me getting the db migration issue resolved!

[Previous page](https://forum.mautic.org/t/mautic-5-migration-issue-internal-server-error-failed-database-migration/34930.md?page=1)
