customer_id = 0 gets assigned
Moderator: moderator
customer_id = 0 gets assigned
I recently imported a large amount of data - and then I noticed that all of the customer_IDs that imported are 0 - it is not incrementing any more. I fixed that with some SQL gymnastics and I also entered the highest customer_id I generated from customer_1_tbl into customer_1_tbl_seq - but then I tried adding a test customer and it again got 0 as customer_id in the customer_1_tbl and no new entry was created in the customer_1_tbl_seq.
What do I do?
I appreciate your help
What do I do?
I appreciate your help
Oh, good customer_1_tbl_seq is not used any more. Can I just drop that table then?
I just looked, I think that's what the bug is.
gives
| Field | Type | Null | Key | Default | Extra |
customer_id | int(11) | NO | | 0 | |
so that might be the bug - that customer_id is not set to autonumber.
I haven't added any customers via SQL but both import wizard ones and individually entered ones come up with 0 as customer_id.
Best,
Peter
I just looked, I think that's what the bug is.
Code: Select all
DESCRIBE customer_1_tbl;
| Field | Type | Null | Key | Default | Extra |
customer_id | int(11) | NO | | 0 | |
so that might be the bug - that customer_id is not set to autonumber.
I haven't added any customers via SQL but both import wizard ones and individually entered ones come up with 0 as customer_id.
Best,
Peter
and I am not sure how to fix it...
After backing up my customer_1_tbl, I did
So now
| Field | Type | Null | Key | Default | Extra
| customer_id | int(11) unsigned | NO | PRI | NULL | auto_increment |
But now what I get when I try to get an overview of recipients or manually add one, I get:
After backing up my customer_1_tbl, I did
Code: Select all
alter table customer_1_tbl change customer_id customer_id Int(11) auto_increment not null;
| Field | Type | Null | Key | Default | Extra
| customer_id | int(11) unsigned | NO | PRI | NULL | auto_increment |
But now what I get when I try to get an overview of recipients or manually add one, I get:
"A general error occurred. Please check your input.
loading ... stopped"
-
- Site Admin
- Posts: 2628
- Joined: Thu Aug 03, 2006 10:20 am
- Location: Munich, Germany
- Contact:
The oldest seed file for the OpenEMM DB I could find in our repository right now is for OpenEMM 5.4, and even it contains
Are you sure you did not tamper with the DB?
Code: Select all
CREATE TABLE `customer_1_tbl` (
`customer_id` int(11) NOT NULL auto_increment,
OpenEMM Maintainer
-
- Site Admin
- Posts: 2628
- Joined: Thu Aug 03, 2006 10:20 am
- Location: Munich, Germany
- Contact:
Back to your question. We use
to set a field to auto_increment. If you insert a new recipient in this table manually what happens? Maybe customer_id wants to start at 0? (You can define a start value <> 0)
Code: Select all
ALTER TABLE `customer_1_tbl` MODIFY `customer_id` int(11) AUTO_INCREMENT;
OpenEMM Maintainer
thanks - I tried that, see result:
Code: Select all
mysql> ALTER TABLE `customer_1_tbl` MODIFY `customer_id` int(11) AUTO_INCREMENT;
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
before I did this I restored the original customer_1_tbl so there wasn't an auto increment column, the current structure is:
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+--------------------------+-------+
| customer_id | int(11) | NO | | 0 | |
I haven't tried the manual SQL insert yet, should we try and make it auto increment first?
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+--------------------------+-------+
| customer_id | int(11) | NO | | 0 | |
I haven't tried the manual SQL insert yet, should we try and make it auto increment first?