Problem in Upgrading to Sugar 8.0

Hi, 
We are having issues while we are upgrading to 8.0.0 from 7.9.4 onsite instance.
Here is our stack
PHP Version 7.1
Mysql Version - 5.7.5
Elastic server version -5.6.11
Apache - 2.4.8
Php Modules Installed
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
imap
intl
json
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
When we are in the process of Upgrading, we get the following error in Sugarcrm.log
Fri Sep  7 10:33:51 2018 [18443][a38f72dc-2085-e9bf-7043-535789b2c38a][FATAL]  Query Failed: ALTER TABLE acl_actions   ADD INDEX idx_del_category_name_acltype_aclaccess (deleted,category,name,acltype,aclaccess): MySQL error 1071: Specified key was too long; max key length is 1000 bytes
Fri Sep  7 10:34:01 2018 [21026][-none-][FATAL] Configuration variable date.timezone is not set, guessed timezone UTC. Please set date.timezone="UTC" in php.ini!
Fri Sep  7 10:34:01 2018 [21026][1][FATAL] An exception occurred while executing 'INSERT INTO audit_events (id, type, parent_id, module_name, source, data, date_created) VALUES (?, ?, ?, ?, ?, ?, ?)' with params ["89183738-b289-11e8-81e1-427017e2a9f9", "update", "8917f638-b289-11e8-ba1b-427017e2a9f9", "SchedulersJobs", "null", "[{\"field_name\":\"assigned_user_id\",\"data_type\":\"id\",\"before\":null,\"after\":\"1\"}]", "2018-09-07 10:34:01"]:
Table 'crm.audit_events' doesn't exist
Fri Sep  7 10:34:01 2018 [21026][1][FATAL] An exception occurred while executing 'SELECT outbound_email.id, outbound_email.name, outbound_email.type, outbound_email.user_id, outbound_email.email_address_id, outbound_email.mail_sendtype, outbound_email.mail_smtptype, outbound_email.mail_smtpserver, outbound_email.mail_smtpport, outbound_email.mail_smtpuser, outbound_email.mail_smtppass, outbound_email.mail_smtpauth_req, outbound_email.mail_smtpssl, outbound_email.deleted, jt0_email_addresses.email_address FROM outbound_email LEFT JOIN email_addresses jt0_email_addresses ON (outbound_email.email_address_id = jt0_email_addresses.id) AND (jt0_email_addresses.deleted = ?) WHERE (outbound_email.id = ?) AND (outbound_email.deleted = ?) LIMIT 1' with params [0, "acec0c2c-39be-01ed-50d1-49da12897fa6", 0]:
Unknown column 'outbound_email.email_address_id' in 'field list'
Attached is the upgrade wizard log file.
_UpgradeWizard _7.9.4.log.zip
  • Hmm its failing pretty early.  Your upgrade log is failing at <your_instance>/upgrade/scripts/post/2_Rebuild.php which is very early in the upgrade process.  Some notes: 

    MySQL error 1071: Specified key was too long; max key length is 1000 bytes

    '1000 limit' is consistent with <=5.6. In 5.7 this limit has increased to 3072 which should be plenty enough to index a utf-8 varchar(255). The fact that you are getting it on 5.7 means you likely have some non-default setting in your mysql instance or perhaps dont actually have 5.7 installed?  You could always try reinstalling MySQL or removing any weird settings you have in my.cnf to see if this goes away.  

    Configuration variable date.timezone is not set, guessed timezone UTC. Please set date.timezone="UTC" in php.ini!

    This is a really important one and should have been set when you first installed Sugar.  Find your php.ini (for example on Debian/RHEL its at etc/php.ini)  and add the line for your time zone.  my setting is:

    [Date]

        date.timezone = "America/New_York"

    You can find a list of supported plain text time zones here: PHP: List of Supported Timezones - Manual 

    Unknown column 'outbound_email.email_address_id' in 'field list'

    here is my output for the outbound_email table.  It doesnt exist in my 8.0 instance either but I'm not sure thats stopping you.  

     mysql> describe outbound_email;
    +-------------------+--------------+------+-----+---------+-------+
    | Field | Type | Null | Key | Default | Extra |
    +-------------------+--------------+------+-----+---------+-------+
    | id | char(36) | NO | PRI | NULL | |
    | name | varchar(50) | YES | | NULL | |
    | type | varchar(15) | YES | | user | |
    | user_id | char(36) | NO | | NULL | |
    | mail_sendtype | varchar(8) | YES | | smtp | |
    | mail_smtptype | varchar(20) | YES | | other | |
    | mail_smtpserver | varchar(100) | YES | | NULL | |
    | mail_smtpport | int(5) | YES | | 0 | |
    | mail_smtpuser | varchar(100) | YES | | NULL | |
    | mail_smtppass | varchar(100) | YES | | NULL | |
    | mail_smtpauth_req | tinyint(1) | YES | | 0 | |
    | mail_smtpssl | int(1) | YES | | 0 | |
    +-------------------+--------------+------+-----+---------+-------+
    12 rows in set (0.00 sec)
     

    If you wanted to, you could add the field just to make the error go away.  In MySQL or PHPmyAdmin perform the following:

    ALTER TABLE outbound_email
    ADD COLUMN email_address_id;

    Table 'crm.audit_events' doesn't exist

    My instance doesnt have this table either.  I dont this this is stopping you either.

  • That is curious.

    The index idx_del_category_name_acltype_aclaccess was created without issue in my instance.

    I do have outbound_email.email_address_id

      `email_address_id` char(36) DEFAULT NULL,

    and I also have the audit_events table:

    CREATE TABLE `audit_events` (
    `id` char(36) NOT NULL,
    `type` char(10) DEFAULT NULL,
    `parent_id` char(36) NOT NULL,
    `module_name` varchar(100) DEFAULT NULL,
    `source` text,
    `data` text,
    `date_created` datetime DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `idx_aud_eve_ptd` (`parent_id`,`type`,`date_created`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    I suspect these should have been created for you.

    I had some problems with the v8.0.0 upgrade and went straight for v8.0.1

    You may want to try that approach.

    FrancescaS

  • I had the same issue. In addition to the above tables, my instance was also missing the erased_fields table;

    CREATE TABLE `erased_fields` (
    `bean_id` char(36) NOT NULL,
    `table_name` varchar(128) NOT NULL,
    `data` text,
    PRIMARY KEY (`bean_id`,`table_name`)
    )
  • MySQL error 1071: Specified key was too long; max key length is 1000 bytes
    It occured to me that the error can still happen with a 5.7+ mysql if your database keeps some of its tables in the MYISAM engine. 

    To fix this, you would have to play this query to collect all the query you will need to play ( tables that are still in MyISAM on your schema ) : 

    SELECT CONCAT('ALTER TABLE ', TABLE_SCHEMA, '.', TABLE_NAME,' ENGINE=InnoDB;') FROM Information_schema.TABLES WHERE TABLE_SCHEMA = '<your_db_name>' AND ENGINE = 'MyISAM';

    and then execute the queries this query will construct.

    Hope it helps !