diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 3de142fcb..5c7a151d7 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -9,7 +9,6 @@ class BuildList < ActiveRecord::Base belongs_to :mass_build, :counter_cache => true has_many :items, :class_name => "BuildList::Item", :dependent => :destroy has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy - has_many :counters_logs, :dependent => :destroy UPDATE_TYPES = %w[security bugfix enhancement recommended newpackage] RELEASE_UPDATE_TYPES = %w[security bugfix] @@ -101,8 +100,6 @@ class BuildList < ActiveRecord::Base after_commit :place_build after_destroy :delete_container - after_create lambda { |build_list| build_list.counters_logs.create(:status => build_list.status, :event => "create", :mass_build_id => build_list.mass_build_id) } - @queue = :clone_and_build state_machine :status, :initial => :waiting_for_response do @@ -110,21 +107,13 @@ class BuildList < ActiveRecord::Base # WTF? around_transition -> infinite loop before_transition do |build_list, transition| if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(BuildList::HUMAN_STATUSES[build_list.status]) - #MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id - MassBuild.transaction do - MassBuild.lock(true).decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id - end - build_list.counters_logs.create(:status => build_list.status, :event => "decrement", :mass_build_id => build_list.mass_build_id) + MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id end end after_transition do |build_list, transition| if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(BuildList::HUMAN_STATUSES[build_list.status]) - #MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id - MassBuild.transaction do - MassBuild.lock(true).increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id - end - build_list.counters_logs.create(:status => build_list.status, :event => "increment", :mass_build_id => build_list.mass_build_id) + MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id end end diff --git a/app/models/counters_log.rb b/app/models/counters_log.rb deleted file mode 100644 index 756471ad5..000000000 --- a/app/models/counters_log.rb +++ /dev/null @@ -1,4 +0,0 @@ -class CountersLog < ActiveRecord::Base - belongs_to :build_list - belongs_to :mass_build -end diff --git a/app/models/mass_build.rb b/app/models/mass_build.rb index a756afd1b..8cdc5c0f9 100644 --- a/app/models/mass_build.rb +++ b/app/models/mass_build.rb @@ -2,7 +2,6 @@ class MassBuild < ActiveRecord::Base belongs_to :platform belongs_to :user has_many :build_lists, :dependent => :destroy - has_many :counters_logs, :dependent => :destroy scope :by_platform, lambda { |platform| where(:platform_id => platform.id) } diff --git a/db/migrate/20120726110848_create_counters_logs.rb b/db/migrate/20120726110848_create_counters_logs.rb deleted file mode 100644 index fdd3f9941..000000000 --- a/db/migrate/20120726110848_create_counters_logs.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateCountersLogs < ActiveRecord::Migration - def change - create_table :counters_logs do |t| - t.integer :mass_build_id - t.integer :build_list_id - t.string :status - t.string :event - t.timestamps - end - end -end diff --git a/db/schema.rb b/db/schema.rb index c21808c13..f39cf11c9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120726110848) do +ActiveRecord::Schema.define(:version => 20120719045806) do create_table "activity_feeds", :force => true do |t| t.integer "user_id", :null => false @@ -143,15 +143,6 @@ ActiveRecord::Schema.define(:version => 20120726110848) do t.integer "project_id" end - create_table "counters_logs", :force => true do |t| - t.integer "mass_build_id" - t.integer "build_list_id" - t.string "status" - t.string "event" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "event_logs", :force => true do |t| t.integer "user_id" t.string "user_name"