Skip to content

Commit

Permalink
[WIP] Add BuildFailure model
Browse files Browse the repository at this point in the history
This model is in charge of keeping track of build failures that we find
when polling the Travis API.  Used to avoid spamming gitter with extra
notifications, but also can be used to identify that a branch has
previously been broken and now has been fixed.

Makes sense to also notify on the passing cases so others aren't taking
the time to investigate a failure when this has already been
investigated.
  • Loading branch information
NickLaMuro committed Jan 14, 2020
1 parent d1623cc commit ff30f83
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
11 changes: 11 additions & 0 deletions app/models/build_failure.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class BuildFailure < ActiveRecord::Base
belongs_to :repo
belongs_to :branch

def notify

end

def still_broken?
end
end
12 changes: 12 additions & 0 deletions db/migrate/20200109223351_create_build_failures.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateBuildFailures < ActiveRecord::Migration
def change
create_table :build_failures do |t|
t.integer :repo_id
t.integer :branch_id
t.integer :travis_build_id

t.datetime :last_notified_at
t.timestamps
end
end
end
11 changes: 10 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20171006050814) do
ActiveRecord::Schema.define(version: 20200109223351) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -48,6 +48,15 @@
t.integer "linter_offense_count"
end

create_table "build_failures", force: :cascade do |t|
t.integer "repo_id"
t.integer "branch_id"
t.integer "travis_build_id"
t.datetime "last_notified_at"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "repos", force: :cascade do |t|
t.string "name", limit: 255
t.datetime "created_at"
Expand Down

0 comments on commit ff30f83

Please sign in to comment.