• Resolved feibuergerenergie

    (@feibuergerenergie)


    Hi.
    I’m wondering, what is a correct default value for id variables in a database?
    E.g., in ..._term_relationships column object_id should be primary key, which means, it has to auto-incremented (A I).

    Query Error:
    #1067 - Wrong DEFAULT Value for 'object_id'
    ALTER TABLE wpstg0_term_relationships CHANGE object_id object_id BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' AUTO_INCREMENT, add PRIMARY KEY (object_id); 

    I tried other numbers (1, 300, 6000), and failed as well (although, 1 was accepted as default. The A I didn’t work, anyway.).
    Can you help me, please?

    PS:
    I’m using the plugin WP Staging – what explains the strange prefix in the table names.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The primary key for the *_term_relationships table is a combination of object_id and term_taxonomy_id so there is no auto-increment on it anywhere. Don’t try and add that… it will be very wrong.

    To add anything to that table manually you need to know the ID of the object (normally post) and the ID of the taxonomy term. Those two together will be the correct values.

    But… I would recommend not doing this manually. Making changes via the admin area would be the best way to do this to ensure that there’s no errors.

    Thread Starter feibuergerenergie

    (@feibuergerenergie)

    Thx a lot for the quick reply and warning recomendation!

    I reset the database with a backup. The very strange thing, then was:
    In my (empty) “staging” phpMyAdmin account, I could upload the SQL dump without any issues. After having uploaded the – very same – dump into the (empty) productive account, rows with option_id = 0 in the _options table appeared. Guess what – now, the staging is the productive account.

    Who knows. This thread’s issue is solved.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.