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

Adding helper for unique index columns to inventory collection #15141

Conversation

Ladas
Copy link
Contributor

@Ladas Ladas commented May 18, 2017

Depends on:

Helper for getting unique_index_columns of IC table from a DB,
asking for explicit definition if there is more than 1
index and asking for adding unique index if there is none.

@Ladas
Copy link
Contributor Author

Ladas commented May 18, 2017

@miq-bot assign @agrare

@Ladas
Copy link
Contributor Author

Ladas commented May 18, 2017

@miq-bot add_label enhancement

@miq-bot
Copy link
Member

miq-bot commented May 18, 2017

This pull request is not mergeable. Please rebase and repush.

Helper for getting unique_index_columns of IC table from a DB,
asking for explicit definition if there is more than 1
index and asking for adding unique index if there is none.
@Ladas Ladas force-pushed the adding_helper_for_unique_index_columns_to_inventory_collection branch from 2ec34e6 to 1b68262 Compare May 18, 2017 15:26
@@ -280,13 +280,16 @@ class InventoryCollection
# inventory_object[:label] = inventory_object[:name]
# So by using inventory_object_attributes, we will be guarding the allowed attributes and will have an
# explicit list of allowed attributes, that can be used also for documentation purposes.
# @param unique_index_columns [Array] Array of symbols identifying a columns of a DB unique index we will be using.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

identifying a columns

just need identifying columns of a DB ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

def unique_index_columns
return @unique_index_columns if @unique_index_columns

unique_indexes = model_class.connection.indexes(model_class.table_name).select { |x| x.unique }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you do select(&:unique)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@agrare
Copy link
Member

agrare commented May 19, 2017

Two small things the rest looks good

Fix rubocop and grammar issues
Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 will merge when green

@miq-bot
Copy link
Member

miq-bot commented May 19, 2017

Checked commits Ladas/manageiq@1b68262~...b0dbd9e with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks fine. 🏆

@agrare agrare merged commit e1229c6 into ManageIQ:master May 19, 2017
@agrare agrare added this to the Sprint 61 Ending May 22, 2017 milestone May 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants