entry id defaulting to zero (0)

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
ianinc
Regular
Posts: 5
Joined: Tue Nov 23, 2010 6:00 pm

entry id defaulting to zero (0)

Post by ianinc »

Currently when someone posts a blog the id value in serendipity_entries defaults to zero and then won't show up. Any help would be much appreciated.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: entry id defaulting to zero (0)

Post by garvinhicking »

Hi!

Which s9y version and which database backend? The id should autoincrement. Maybe you imported a SQL dump and forget to export autoincrement keys?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ianinc
Regular
Posts: 5
Joined: Tue Nov 23, 2010 6:00 pm

Re: entry id defaulting to zero (0)

Post by ianinc »

Thank you for the response. I'm on version 1.5.2. Any direction would be much appreciated.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: entry id defaulting to zero (0)

Post by garvinhicking »

Hi!

I also need your database type... and what about my question about migration?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ianinc
Regular
Posts: 5
Joined: Tue Nov 23, 2010 6:00 pm

Re: entry id defaulting to zero (0)

Post by ianinc »

I was kind of handed this blog so I'm not sure what happened. I think it was upgraded right before it was passed on to me but I don't know how they did it. The database is phpMyAdmin.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: entry id defaulting to zero (0)

Post by garvinhicking »

Hi!
ianinc wrote:I was kind of handed this blog so I'm not sure what happened. I think it was upgraded right before it was passed on to me but I don't know how they did it. The database is phpMyAdmin.
phpMyAdmin is a tool; but surely you mean MySQL. You'll need to check if your serendipity_entries has a autoincrement primary key on the "id" column.

Ideally, you should get someone proficient with MySQL to check your migration path, because obviously whoever executed the migration/upgrade didn't properly do that...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ianinc
Regular
Posts: 5
Joined: Tue Nov 23, 2010 6:00 pm

Re: entry id defaulting to zero (0)

Post by ianinc »

I surely do mean MySQL. I checked the entries column and tried to add the autoincrement primary key but it gave me an error "#1062 - Duplicate entry '26' for key 1". I don't live in an ideal world right now so I need to fix this. Would like any help you could give me. Thanks.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: entry id defaulting to zero (0)

Post by garvinhicking »

ianinc wrote:I surely do mean MySQL. I checked the entries column and tried to add the autoincrement primary key but it gave me an error "#1062 - Duplicate entry '26' for key 1". I don't live in an ideal world right now so I need to fix this. Would like any help you could give me. Thanks.
Hi!

Adding an autoincrement later is a bit hard; how many entries do you have? I'd edit each row and give it a unique ID, so that after that you can add the autoincrement.

If you have too many entries with the same ID, you would need to export the table as an SQL dump WITHOUT the "id" column, then empty the table, then add the autincrement key and then re-import the SQL dump. But the first method would be better because it involves less points of failures ;)

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
ianinc
Regular
Posts: 5
Joined: Tue Nov 23, 2010 6:00 pm

Re: entry id defaulting to zero (0)

Post by ianinc »

there was only about 30 so I plugged in sequential numbers over that and then I was able to edit the entries column with the primary key autoincrement. Worked like a charm, thanks for the help.
Post Reply