Internal error - after migration
Added by Dean Foster over 5 years ago
Have migrated from 2.1.4 to  4.1.1 running on a new server.
Following all the steps and upgraded the database using ruby bin/rake db:migrate RAILS_ENV=production and I get the followng error at the start
D:\Redmine-4.1.1-2\apps\redmine\htdocs>ruby bin/rake db:migrate RAILS_ENV=production
 20161010081301 ChangeIssuesDescriptionLimit: migrating ===================
-- change_column(:issues, :description, :text, {:limit=>16777216})
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Incorrect date value: '0000-00-00' for column 'due_date' at row 358: ALTER TABLE `issues` CHANGE `description` `description` longtext DEFAULT NULL
The new Redmine still works, but I get an internal 500 error when trying to open any project or ticket, the same happens when opening the 'trackers' section from the administration page.
I have removed the only plugin and this makes no difference.
I have also attached the log when the error appears.
Old Environment:
  Redmine version                          2.1.4.stable
  Ruby version                             1.9.3 (i386-mingw32)
  Rails version                            3.2.8
  Environment                              production
  Database adapter                         Mysql2
Redmine plugins:
  redirect_to_after_login                  0.0.2
New Environment:
  Redmine version                4.1.1.stable
  Ruby version                   2.5.8-p224 (2020-03-31) [x64-mingw32]
  Rails version                  5.2.4.2
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Git                            2.27.0
  Filesystem                     
Redmine plugins:
  no plugin installed
Replies (6)
    
    RE: Internal error - after migration
    -
    Added by Pavel Potcheptsov over 5 years ago
  
  It looks like your database server has changed to the new version too. Am I right?
    
    RE: Internal error - after migration
    -
    Added by Dean Foster over 5 years ago
  
  Hi!
Yes thats right and I ran the command to upgrade the database but got that error,
    
    RE: Internal error - after migration
    -
    Added by Pavel Potcheptsov over 5 years ago
  
  I mean that version of your database server has been changed.
The sign of that is error "Mysql2::Error: Incorrect date value: '0000-00-00' for column 'due_date'" 
Modern version of Mysql server doesn't allow above value in date columns.
You can try to disable strict mode on mysql server to see if it help. Or change all '0000-00-00' values to NULL.
Backup your database first.
    
    RE: Internal error - after migration
    -
    Added by Dean Foster over 5 years ago
  
  Hi, I ran the attached but still errors?
How can I change all '0000-00-00' values to NULL ?
Thanks ever so
| Capture.PNG (118 KB) Capture.PNG | 
    
    RE: Internal error - after migration
    -
    Added by Pavel Potcheptsov over 5 years ago
  
  Use this command:
mysql -u root -p -e "SET GLOBAL sql_mode = 'NO_ENGINE_SUBSTITUTION';" 
And then try database migration:
ruby bin/rake db:migrate RAILS_ENV=production
    
    RE: Internal error - after migration
    -
    Added by Dean Foster over 5 years ago
  
  worked a treat
thank you