Every new row in DB gets id of 0

Added by Mitchell Smith 3 months ago


I had to recover a redmine database from an old server and redeploy it onto a new VMware VM. I built the redmine server, extracted the database from a MariaDB on the old server, then overwrote the default database with the old one.

Pages were not displaying and I was getting unknown primary key errors. I had to modify some of the ruby models and insert "self.primary_key = 'id'" in order to get pages to display correctly with the old database.

However, even though the old data is displaying correctly, any change on redmine updates the database and every new row gets an id of 0 rather than incrementing to the next available id number.

I've attempted to solve this by setting the initial auto increment value in MySQL with the following command "ALTER TABLE users AUTO_INCREMENT=n;" But the issue persists.

Any assistance would be appreciated.

Redmine 3.4.6
OS: CentOS-release-7.5.1804.e17.centos.2.x86x64
Apache 2.4.37
SQL: MySQL ver 14.4 Distrib 5.6.42
Ruby: 2.3.8
Rails: 4.2.8