Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2222

MySQLAdapter should not create indexes on FK columns

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.0.M5
    • None
    • None

    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.

      Attachments

        Activity

          People

            andrus Andrus Adamchik
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: