Project

General

Profile

Bug #589

ERROR 1062 (23000) Duplicate entry for key 'PRIMARY' after upgrade from 1.0.021 to 1.0.022

Added by mommeke over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
10/31/2015
Due date:
% Done:

100%

Estimated time:
Resolution:
Fixed

Description

When starting domotiga after the upgrade, it prompts to upgrade the db, I choose Yes, it prompts to backup the db, I choose yes, it confirms the backup is finished, and after that it throws this error "Mysql command returned an error! The database is now at version 1.0.021
Domotiga starts when I click OK, but it keeps the old db version (when I close domotiga and try again it asks again to upgrade the db)

I start domotiga from gnome-terminal and see this (tried several times, same error but line and entry sometimes differs):
andy@homeserver:~/domotiga$ ./DomotiGa3.gambas
ERROR 1062 (23000) at line 49 in file: '/home/andy/domotiga/upgrade/10021to10022.sql': Duplicate entry '94' for key 'PRIMARY'
andy@homeserver:~/domotiga$ ./DomotiGa3.gambas
ERROR 1062 (23000) at line 4 in file: '/home/andy/domotiga/upgrade/10021to10022.sql': Duplicate entry '671' for key 'PRIMARY'
QClipboard: Unable to receive an event from the clipboard manager in a reasonable time

History

#1 Updated by mommeke over 3 years ago

I deleted all lines in "10021to10022.sql" that the error referred to, and now I don't get the message anymore so it looks like the upgrade is done. However I'm not sure if this action can cause any harm like corruption in the db or unavailable features?
The only lines remaining in the .sql file are:

CREATE TABLE `sslcertificate` (
  `id` int(11) NOT NULL,
  `name` varchar(64) NOT NULL DEFAULT '',
  `certificate` varchar(128) NOT NULL DEFAULT '',
  `private` varchar(128) NOT NULL DEFAULT '',
  `client` varchar(128) NOT NULL DEFAULT '',
  `description` text,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Finally update to 1.0.022
--

LOCK TABLES version WRITE;
INSERT INTO version VALUES (67,'1.0.022');
UNLOCK TABLES;

#2 Updated by jessekerkhoven over 3 years ago

The install file of version 1.0.021 was incorrect and there for the upgrade file for 1.0.022. I have updated the master and beta branch.

Currently you have a partly upgrade database. There are 2 options to fix this.
  1. Remove your database and restore your backup and git pull and afterwards run the upgrade again. (But please make sure your backup is correct)
  2. Run the following lines by hand https://github.com/DomotiGa/DomotiGa/blob/beta/upgrade/10021to10022.sql#L49-L77 and afterwards start DomotiGa.

#3 Updated by jessekerkhoven over 3 years ago

I see your comment, please run the following command to fix the differences:

--
-- Fix 10020 to 10021 upgrade problem
--
DELETE FROM plugins WHERE id=94;

INSERT INTO plugins (`id`, `interface`, `name`, `type`) VALUES (94, 'GPS', 'GPS', 'class');
INSERT INTO plugins (`id`, `interface`, `protocols`, `name`, `type`) values (95,'Buienradar','','Buienradar','class');

#4 Updated by jessekerkhoven over 3 years ago

  • Status changed from New to Feedback
  • Target version set to 1.0.022
  • % Done changed from 0 to 100
  • Resolution set to Fixed

#5 Updated by mommeke over 3 years ago

I believe that went well:

mysql> select * from plugins where id=95;
+----+------------+-----------+------------+-------+
| id | interface  | protocols | name       | type  |
+----+------------+-----------+------------+-------+
| 95 | Buienradar |           | Buienradar | class |
+----+------------+-----------+------------+-------+
1 row in set (0.00 sec)

mysql> select * from plugins where id=94;
+----+-----------+-----------+------+-------+
| id | interface | protocols | name | type  |
+----+-----------+-----------+------+-------+
| 94 | GPS       |           | GPS  | class |
+----+-----------+-----------+------+-------+
1 row in set (0.00 sec)

Thanks for your very quick support!

#6 Updated by jessekerkhoven over 3 years ago

  • Status changed from Feedback to Closed

Great, closing

Also available in: Atom PDF