FFFF Can not activate plugin, Foreign key constraint is incorrectly formed · Issue #91 · dominik-th/matomo-plugin-LoginOIDC · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 11, 2026. It is now read-only.
This repository was archived by the owner on Nov 11, 2026. It is now read-only.

Can not activate plugin, Foreign key constraint is incorrectly formed #91

Open

Description

@staeglis

I have the same issue as described there:
#31 (comment)
#1

I've checked the tables adn tried the mentioned workarounds. All using innodb with utf8mb4. What else could cause the error?

Best,
Stefan

Activity

  1. staeglis commented on May 5, 2023

    @staeglis
    Author

    I was able to create the table with this SQL command:

    CREATE TABLE matomo_loginoidc_provider ( user VARCHAR( 100 ) NOT NULL, provider_user VARCHAR( 255 ) NOT NULL, provider VARCHAR( 255 ) NOT NULL, date_connected TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY ( provider_user, provider ), UNIQUE KEY user_provider ( user, provider ), FOREIGN KEY ( user ) REFERENCES matomo_user ( login ) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
    
  2. HatBeardZero commented on Feb 27, 2024

    @HatBeardZero

    I was able to create the table with this SQL command:

    CREATE TABLE matomo_loginoidc_provider ( user VARCHAR( 100 ) NOT NULL, provider_user VARCHAR( 255 ) NOT NULL, provider VARCHAR( 255 ) NOT NULL, date_connected TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY ( provider_user, provider ), UNIQUE KEY user_provider ( user, provider ), FOREIGN KEY ( user ) REFERENCES matomo_user ( login ) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
    

    I am trying to get this going on mysql 8 and matomo 5.x, and i get this when i try to run that.

    Referencing column 'user' and referenced column 'login' in foreign key constraint 'matomo_loginoidc_provider_ibfk_1' are incompatible.

    any thoughts where i can look?

  3. nbaud commented on Mar 21, 2024

    @nbaud

    For me the trick was to modify the charset very precisely to what it is in the database with utf8mb3_general_ci
    Without that the above query would not work.

    For instance, check your database with

    SHOW FULL COLUMNS FROM piwik_user;
    (in my case)
    Then adapt your query according to what you see. It needs to match perfectly otherwise you will get that weird misleading error message.

    This went fine and the plugin got activated after passing the following query:

    MariaDB [matomo]> CREATE TABLE piwik_loginoidc_provider (
        ->     user VARCHAR(100) NOT NULL,
        ->     provider_user VARCHAR(255) NOT NULL,
        ->     provider VARCHAR(255) NOT NULL,
        ->     date_connected TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
        ->     PRIMARY KEY (provider_user, provider),
        ->     UNIQUE KEY user_provider (user, provider),
        ->     FOREIGN KEY (user) REFERENCES piwik_user (login) ON DELETE CASCADE
        -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
    
  4. sdellenb commented on Jan 10, 2026

    @sdellenb

    @nbaud Thanks, that helped me get Matomo going again. In my case, it was utf8mb4_general_ci.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0