Closed otegami closed 8 months ago
Could you enable GitHub Actions on your fork?
@kou Thanks. I've just enabled it here: https://github.com/otegami/redmine_full_text_search/actions
I will check it tomorrow morning again!
Thank you for reviewing🙏
@kou
I am concerned about using the created_at
column because these names suggest automatic updating on Rails context, which might lead to misunderstandings. I'm trying to think of an alternative name. And I'm considering registered_at
as it seems close to created_at. What do you think?
@kou Thank you for reviewing🙏
I think that registered_at isn't so bad but do you have more suggestions?
How about the following list?
In my opinion, the meaning of registered_at
or recorded_at
seems close to created_at in this context.
recorded_at
initialized_at
stored_at
generated_at
@kou Thank you for reviewing!
I wanted to generate queries without embedding variables in SQL but I couldn't find the way to do that. The following code is what I tried for it.
types = [Issue, Message, Project, WikiPage]
fts_target_table = FtsTarget.arel_table
types.each do |type|
subquery_for_created_on = type.where(type.arel_table[:id].eq(fts_target_table[:source_id]))
.select(:created_on)
subquery_for_fts_type_id = FtsType.where(name: type.table_name.singularize.camelize)
.select(:id)
manager = Arel::UpdateManager.new
manager.table(fts_target_table)
manager.set([[fts_target_table[:registered_at], Arel::Nodes::Grouping.new(subquery_for_created_on)]])
manager.where(fts_target_table[:source_type_id].in(Arel::Nodes::Grouping.new(subquery_for_fts_type_id)))
ActiveRecord::Base.connection.execute(manager.to_sql)
end
FYI: Our priorities in order:
Thank you for reviewing. I understood the priorities. Thank you so much!
@kou
Could you update the PR title and description based on the latest design?
Thanks, I've just updated it.
Thank you for reviewing. I think this PR is ready for merge if you don't have any other concerns.
Related: https://github.com/clear-code/redmine_full_text_search/issues/115
What I did
registered_at
column to fts_targets tablefts_targets.registered_at
What I checked
I checked whether I can roll back this migration.
Ask for reviewers
I struggled with deciding how to update the registered_at field for fts_targets records related to thechanges
andchangesets
tables. If you have a good idea, please let me know!last_modified_at