forked from e621ng/e621ng
track when tag subscriptions are used (for pruning)
This commit is contained in:
parent
abbaf7f7ec
commit
0457fa144d
@ -72,6 +72,10 @@ class TagSubscription < ActiveRecord::Base
|
||||
if name
|
||||
relation = relation.where(["name ILIKE ? ESCAPE E'\\\\'", name.to_escaped_for_sql_like])
|
||||
end
|
||||
|
||||
relation.each do |tag_sub|
|
||||
tag_sub.update_column(:last_accessed_at, Time.now)
|
||||
end
|
||||
|
||||
relation.map {|x| x.post_ids.split(/,/)}.flatten.uniq.map(&:to_i).sort.reverse.slice(0, limit)
|
||||
end
|
||||
|
@ -6,6 +6,7 @@ class CreateTagSubscriptions < ActiveRecord::Migration
|
||||
t.column :tag_query, :string, :null => false
|
||||
t.column :post_ids, :text, :null => false
|
||||
t.column :is_public, :boolean, :null => false, :default => true
|
||||
t.column :last_accessed_at, :datetime
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user