GENWiki

Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


computerfaq:unknown_database_type_bit_requested_doctrine_dbal_platforms_mysqlplatform_may_not_support_it

Unknown database type bit requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it

This may occur after a module update, or system update failed. The problem is corruption of configuration. Once this error occurs everything breaks, reload won't reload, update won't update and so on.

Background

FreePBX for whatever reason uses Doctrine to make the code database independent. I'm not sure why this was ever a thing, but it is. Doctrine 'translates' queries to match the underlying database. One of the ways it does this is by cross-converting column types between vendors, such as Varchar(MAX) on SQL Server = longtext on MySql and so on. In this case 'bit' is a valid database column-type but the 'translation' doesn't know that.

Recovery isn't simple and requires some editing of php code. There may be other ways to resolve but if you want a quick fix then this worked for us, but remember this advice is provided to the community free of charge and comes without any warranty. If you are using FreePBX commercially and want to consider a maintenance agreement to have experts fix issues like this for you then contact our sponsor.

Open this file in vi or nano. /var/www/html/admin/libraries/Composer/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php

Towards the end of this file is a list of types that look like this:

   protected function initializeDoctrineTypeMappings()
    {
     	$this->doctrineTypeMapping = array(
            'tinyint'       => 'boolean',
            'smallint'      => 'smallint',
            'mediumint'     => 'integer',
            'int'           => 'integer',
            'integer'       => 'integer',
            'bigint'        => 'bigint',
            'tinytext'      => 'text',
            'mediumtext'    => 'text',
            'longtext'      => 'text',
            'text'          => 'text',
            'varchar'       => 'string',
            'string'        => 'string',
            'char'          => 'string',
            'date'          => 'date',
            'datetime'      => 'datetime',
            'timestamp'     => 'datetime',
            'time'          => 'time',
            'float'         => 'float',
            'double'        => 'float',
            'real'          => 'float',
            'decimal'       => 'decimal',
            'numeric'       => 'decimal',
            'year'          => 'date',
            'longblob'      => 'blob',
            'blob'          => 'blob',
            'mediumblob'    => 'blob',
            'tinyblob'      => 'blob',
            'binary'        => 'binary',
            'varbinary'     => 'binary',
            'set'           => 'simple_array',
        );
    }

You'll need to add an additional type here for bit so stick it above the 'tinyint' ⇒ line.

'bit' => 'boolean',

Now save and try updating modules again from the commmand line

fwconsole ma updateall –force

that should now work, you can then go back to your freepbx web gui, go to Admin/Module Admin, make sure it hasn't disabled any that should be enabled (if it has, select them, upgrade and enable/downgrand and enable then process). Finally a reload should complete.

/data/webs/external/dokuwiki/data/pages/computerfaq/unknown_database_type_bit_requested_doctrine_dbal_platforms_mysqlplatform_may_not_support_it.txt · Last modified: 2020/12/05 18:19 by genadmin