Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jason Crouse

    (@coolmann)

    The upgrade from version 3.9 to version 4.0 introduces a new table, which for some reason was not created when you updated the plugin.

    You can try to create it in phpMyAdmin by using the SQL code in here:

    https://plugins.trac.www.ads-software.com/browser/wp-slimstat/trunk/admin/wp-slimstat-admin.php#L261

    If have seen (and ignored for quite a while) this on 3 different multisite installations, one not even maintain be me. I do think that some circumstances/installations may lead to this error.

    I have tried to create one missing table like this:

    CREATE TABLE IF NOT EXISTS sc_629_slim_events (
    event_id int(10) NOT NULL AUTO_INCREMENT,
    type tinyint(3) unsigned DEFAULT ‘0’,
    event_description varchar(64) DEFAULT NULL,
    notes varchar(256) DEFAULT NULL,
    position varchar(32) DEFAULT NULL,
    id int(10) unsigned NOT NULL DEFAULT ‘0’,
    dt int(10) unsigned DEFAULT ‘0’,
    PRIMARY KEY (event_id),
    KEY idx_sc_629_slim_events (dt),
    KEY fk_sc_629_id (id),
    CONSTRAINT fk_sc_629_id FOREIGN KEY (id) REFERENCES sc_629_slim_stats (id) ON DELETE CASCADE ON UPDATE CASCADE
    ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;n

    But mysql responds with:

    160519 13:30:55 Error in foreign key constraint creation for table fak-sites.sc_629_slim_events.
    A foreign key constraint of name fak-sites.fk_sc_629_id
    already exists.

    Please advise how to proceed.

    Plugin Author Jason Crouse

    (@coolmann)

    Hi,

    for some reason you have a foreign key with that name already. Probably a leftover of a previous database upgrade?

    You can change the CONSTRAINT to read:

    CONSTRAINT fk_sc_629_slimstats_id FOREIGN KEY (id) REFERENCES

    and leave the rest unchanged. Let me know if that works.

    Best,
    Jason

    Yes, by changing the symbol I can execute the create statement. It also seem to cure the problem as I can now visit (and leave by link to external resource) the blog in question without error messages. I am a bit puzzled though as no data is entered in the mentioned table.

    I must admit though that I have not much idea on what am I actually doing. Mysql constraints is above my current sql knowledge level.

    Should I make a similar CREATE statement for all active subsites on our system?

    Regards
    Klaus

    Plugin Author Jason Crouse

    (@coolmann)

    I am a bit puzzled though as no data is entered in the mentioned table.

    Slimstat uses this table to store information about events (click coordinates, custom client-side events, etc). If you don’t have any of those on your site, the table will stay empty.

    Should I make a similar CREATE statement for all active subsites on our system?

    Each blog in your MU network will need one, yes. Make sure to reference the right tables, though.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Database error’ is closed to new replies.