This project is archived and is in readonly mode.
Partial indices using add_index in DB migrations
-
Jason Yuen
- Title changed from Partial indicies using add_index in DB migrations to Partial indices using add_index in DB migrations
-
Pratik
- State changed from new to incomplete
Could you please submit a patch for this ? http://guides.rails.info/contrib... should come handy.
Thanks !
-
Max Lapshin
Jason. It is very easy to monkey patch schema adaptor to add this functionality, but full patch is rather hard, because database driver must dump properly data of partial index.
Take attached monkey patch and put it into config/initializers/ add_index :people, [:gender], :name => "male_idx", :options => "WHERE gender = 'm'"
-
CancelProfileIsBroken
- Tag changed from db, index, migrations, partial to bugmash, db, index, migrations, partial
-
Jason Yuen
Just heard about BugMash and I would like to help out with this ticket. I was envisioning the same type of patch (adding options) but I noticed you (Max) mentioned that the full patch is rather hard. Can you please clarify what you mean by the database driver needing to dump data of the partial index? Thanks for clarifying!
-
Elad Meidar
@Jason: as far as i can see (Google, that is), mysql does not support "where" clauses in CREATE INDEX syntax.. could it be that it's just a postgres's feature?
-
Jason Yuen
Since the where clause would be added as an option, is it fair to say that create_index will simply generate an invalid statement if the optional parameters (WHERE clause or otherwise) are invalid for the particular database you are using? I see this as similar to calls to find_by_sql where, if you put DB-specific syntax, it's usually because you know that you are using a particular database.
-
Rizwan Reza
- Tag changed from bugmash, db, index, migrations, partial to db, index, migrations, partial
-
Santiago Pastorino
- State changed from incomplete to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
