Skip to content

WIP Unify queries under target_versions#24368

Draft
brunopagno wants to merge 1 commit into
devfrom
blp/impl/target-versions-queries-consolidation
Draft

WIP Unify queries under target_versions#24368
brunopagno wants to merge 1 commit into
devfrom
blp/impl/target-versions-queries-consolidation

Conversation

@brunopagno

Copy link
Copy Markdown
Contributor

Ticket

I didn't create a ticket yet

What are you trying to accomplish?

Doing some challenging things

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@brunopagno brunopagno self-assigned this Jul 21, 2026
def rewrite_filters
ActiveRecord::Base.connection.exec_update(<<~SQL.squish)
UPDATE queries
SET filters = regexp_replace(filters, '(^|\\n)(:?)version_id:', '\\1\\2target_version_id:', 'g')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

regexp_replace

I'm honestly not too confident about these so far -- if we mess something up, it's gonna be really hard to go back, and the blast radius could theoretically be all users...

The original approach assumed a "compatibility layer" where we internally translated those all version fields to our target_versions. How complex was this? Is the regex really worth it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants