mirror of https://github.com/mastodon/mastodon
Extract scenic view model common methods to concern (#28111)
parent
1666b19559
commit
86500e3312
@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module DatabaseViewRecord
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
class_methods do
|
||||
def refresh
|
||||
Scenic.database.refresh_materialized_view(
|
||||
table_name,
|
||||
concurrently: true,
|
||||
cascade: false
|
||||
)
|
||||
rescue ActiveRecord::StatementInvalid
|
||||
Scenic.database.refresh_materialized_view(
|
||||
table_name,
|
||||
concurrently: false,
|
||||
cascade: false
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def readonly?
|
||||
true
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue