Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't add indices on columns with UNIQUE constraint #113

Open
wants to merge 3 commits into
base: maint/0.0828xx
Choose a base branch
from

Commits on Feb 4, 2017

  1. fix: Don't add indices on columns with UNIQUE constraint

    SQL::Translator::Parser::DBIx::Class adds an index to foreign key
    columns as this "is normally the sensible thing to do". Agreed.
    
    Besides SQL::Translator::Parser::DBIx::Class takes care to not add an
    additional index to primary key columns ("some RDBMS croak on this, and
    it generally doesn't make much sense") but doesn't consider columns with
    a UNIQUE constraint where it doesn't make any sense either.
    
    Generally this should not be dangerous but it doesn't help at all.
    From my understanding the SQL optimizer will use the better index thus
    the UNIQUE constraint would win in any case.
    
    Even worse any INSERT, UPDATE or DELETE operation would need to maintain
    the index which is never used. This does not sound sensible to me.
    
    The supposed patch avoids the adding of those indices if the column is
    checked if it is *the first column* of a UNIQUE constraint. If it's not
    the index is added, if it is the first column it is handled like a
    primary key.
    hidden-primary-net committed Feb 4, 2017
    Configuration menu
    Copy the full SHA
    fa718e2 View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2017

  1. test: Add test for redundant indices

    I want to achieve a test checking the given schema for automatic indices
    on foreign key columns actually being covered by a UNIQUE constraint.
    
    Unfortunately I don't understand the difference between this test and
    t/86sqlt.
    
    * I have to "use SQL::Translator"
    * tables are not populated in SQL::Translator->schema
    * SQL::Translator->schema->get_table returns undef
    hidden-primary-net committed Feb 5, 2017
    Configuration menu
    Copy the full SHA
    fa24a5b View commit details
    Browse the repository at this point in the history

Commits on Jul 1, 2017

  1. test: Add build dependency

    Test were failing earlier, thus adding SQL::Translator build dep.
    hidden-primary-net committed Jul 1, 2017
    Configuration menu
    Copy the full SHA
    2de8fe4 View commit details
    Browse the repository at this point in the history