Improve various queries against account domains (#25126)

This commit is contained in:
Claire
2023-05-25 09:27:16 +02:00
committed by GitHub
parent e58c36d308
commit 1d588d58f1
7 changed files with 42 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ class Instance < ApplicationRecord
end
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
scope :by_domain_and_subdomain, ->(domain) { where("reverse('.' || domain) LIKE reverse(?)", "%.#{domain}") }
def self.refresh
Scenic.database.refresh_materialized_view(table_name, concurrently: true, cascade: false)