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 01:33:41 UTC

[jira] [Updated] (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 updated CAY-2222:
---------------------------------
    Description: 
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.




  was:
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 indexe 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. After all MySQL 4.1.2 was released in 2004. 





> 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)