Women in Technology

Hear us Roar

  Rolling with Ruby on Rails
Subject:   HeidiSQL
Date:   2007-02-22 09:10:53
From:   trance_
Since the MySQL-Front isn't available, I went for the free HeidiSQL.

This weird thing happens when I try to add additional items to the database. It's as if the id field in the recipies table never increments.

Adding the first recipe went fine, however adding a second one gives me something like this:

Mysql::Error: #23000Duplicate entry '0' for key 1: INSERT INTO recipes ... blah blah blah

If I go to Heidi and manually change the field default value from 0 to 1, then I can go add a second recipe. But, adding a third recipe does the same thing. I can manually keep changing the default value from 0, to 1, to 2, to 3, and so on, to continue to add items.

I can open the id field and put a check on "AutoIncrement", but that doesn't seem to do anything. When I look at it again, and I open it back up, AutoIncrement is unchecked.

So... is this a problem with HeidiSQL?

Or is there something I've missed completely?

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • HeidiSQL
    2007-08-20 08:45:59  philippe.rathe [View]

    Trance, I had a similar problem and solve it. It is not related to your DB Engine. In the ruby migration add the :id => false to your table definition, because you don't need it at all. This is for tables that are a join table between two tables.

    create_table "categories_posts", :id => false, :force => true do |t|
    t.column ...
  • Curt Hibbs photo HeidiSQL
    2007-02-22 09:44:27  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

    I haven't used HeidiSQL yet, but maybe you can't change it after the field is already defined?

    Try deleting the table and then recreate it with an autoincrement id field.