You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2017/02/09 02:24:41 UTC

[jira] [Closed] (CAY-2222) MySQLAdapter should not create indexes on FK columns

     [ https://issues.apache.org/jira/browse/CAY-2222?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik closed CAY-2222.
--------------------------------
    Resolution: Fixed

side effect - we no longer attempt to guess whether "FKs are supported". It wasn't a reliable switch to begin with, as it checked for InnoDB support at the DB level, while individual tables may have been MyISAM. So now it always assumes FKs are supported, leaving it up to the user to skip FK constraint generation.


> MySQLAdapter should not create indexes on FK columns
> ----------------------------------------------------
>
>                 Key: CAY-2222
>                 URL: https://issues.apache.org/jira/browse/CAY-2222
>             Project: Cayenne
>          Issue Type: Bug
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>            Priority: Minor
>             Fix For: 4.0.M5
>
>
> MySQLAdapter has this comment in the "createTableAppendPKClause" method:
> // if FK constraints are supported, we must add indices to all FKs
> // Note that according to MySQL docs, FK indexes are created
> // automatically when constraint is defined, starting at MySQL 4.1.2
> And then it proceeds to add indexes for all FKs. This becomes a problem when a user wants to generate MySQL schema without FK constraints. In which case those columns still end up having an index. While we can refactor this in a backwards compatible manner, I think we can just drop support for explicit index creation, streamlining the code. After all MySQL 4.1.2 was released in 2004. 
> If someone still needs support for older MySQL, I guess a whole new adapter should be created.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)