-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add support for destroying a custom field #109
Conversation
We should remove entries that refer nonexistent Redmine records instead of not touching them on search. |
Thanks! |
|
||
class RedmineCustomFieldMapper < RedmineMapper | ||
class << self | ||
def with_project(redmine_class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Do we need to do something in with_project
? I think this Mapper is not be used with project because custom field is independent from project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with_project
is for mapper that needs JOIN
to collect related projects.
def with_project(redmine_class) | ||
end | ||
|
||
def not_mapped(redmine_class, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: What is not_mapped
? When we need this method? Do we need to do some thing in this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not_mapped
is for collecting Redmine records that are not mapped (corresponding FullTextSearch::Target
doesn't exist). It's used to synchronize Redmine records and `FullTextSearch::Target.
end | ||
end | ||
|
||
class FtsCustomFieldMapper < FtsMapper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are nothing to do.
So, maybe it is better to not define this class and use FtsMapper directly.
Concern: This changes don't remove already left fts records. (The error is not resolved only apply this changes, already left fts records should be removed.) |
When we should remove the already left (orphan) fts records?
|
Would you review this when you have time? |
|
GitHub: fix GH-108
If a searchable
CustomField
is destroyed, correspondingFullTextSearch::Target
records are also destroyed.We can't use existing mapper mechanism for it because
CustomField
useshas_many :custom_values, :dependent => :delete_all
relation. It doesn't callafter_destroy
callback that isneeded to synchronize
CustomFieldValue
andFullTextSearch::Target
.We can remove orphaned
FullTextSearch::Target
for destroyedCustomFieldValue
bybin/rails full_text_search:synchronize
.