Improve various queries against account domains (#25126)
This commit is contained in:
parent
e58c36d308
commit
1d588d58f1
7 changed files with 42 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue