Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions app/models/logfile.rb

This file was deleted.

13 changes: 13 additions & 0 deletions db/migrate/20260727095902_drop_logfiles.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class DropLogfiles < ActiveRecord::Migration[8.1]
def change
drop_table :logfiles do |t|
t.datetime :created_at, precision: nil
t.binary :data
t.string :ext
t.integer :report_id
t.datetime :updated_at, precision: nil
t.index [:report_id, :ext], name: "index_logfiles_on_report_id_and_ext", unique: true
t.index [:report_id], name: "index_logfiles_on_report_id"
end
end
end
12 changes: 1 addition & 11 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[8.1].define(version: 2026_07_27_051843) do
ActiveRecord::Schema[8.1].define(version: 2026_07_27_095902) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"

Expand Down Expand Up @@ -42,16 +42,6 @@
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
end

create_table "logfiles", force: :cascade do |t|
t.datetime "created_at", precision: nil
t.binary "data"
t.string "ext"
t.integer "report_id"
t.datetime "updated_at", precision: nil
t.index ["report_id", "ext"], name: "index_logfiles_on_report_id_and_ext", unique: true
t.index ["report_id"], name: "index_logfiles_on_report_id"
end

create_table "recents", force: :cascade do |t|
t.datetime "created_at", null: false
t.string "etag", null: false
Expand Down
33 changes: 0 additions & 33 deletions lib/tasks/scheduler.rake
Original file line number Diff line number Diff line change
Expand Up @@ -28,39 +28,6 @@ task :inspect_env => :environment do
p URI("http://www.yahoo.co.jp").read(100) rescue nil
end

desc "fetch old logfiles"
task :fetch_logfile => :environment do
Report.
joins("LEFT OUTER JOIN logfiles AS l1 ON
reports.id = l1.report_id AND l1.ext='log.txt'").
joins("LEFT OUTER JOIN logfiles AS l2 ON
reports.id = l2.report_id AND l2.ext='diff.txt'").
joins("LEFT OUTER JOIN logfiles AS l3 ON
reports.id = l2.report_id AND l3.ext='log.html'").
joins("LEFT OUTER JOIN logfiles AS l4 ON
reports.id = l4.report_id AND l4.ext='diff.html'").
where('l1.report_id IS NULL OR l2.report_id IS NULL OR
l3.report_id IS NULL OR l4.report_id IS NULL').
where('reports.server_id = 4').
select(['reports.*',
'l1.id AS l1id', 'l2.id AS l2id', 'l3.id AS l3id', 'l4.id AS l4id']).
find_each do |r|
t = r.datetime.strftime('%Y%m%dT%H%M%SZ')
lids = [r.l1id, r.l2id, r.l3id, r.l4id]
%w[log.txt diff.txt log.html diff.html].each_with_index do |ext, i|
next if lids[i]
uri = "#{r.server.uri}ruby-#{r.branch}/log/#{t}.#{ext}.gz"
puts uri
begin
data = URI(uri).read
Logfile.create(report_id: r.id, ext: ext, data: data)
rescue => e
p e
end
end
end
end

desc "sync server settings"
task :sync_servers => :environment do
require 'open-uri'
Expand Down
Loading