[schema] Added checks#consecutive_failures (integer)

This commit is contained in:
Colin Darie 2018-08-01 10:32:34 +02:00
parent f0a8c719d1
commit 75b429e395
No known key found for this signature in database
GPG Key ID: 4FB865FDBCA4BCC4
5 changed files with 54 additions and 43 deletions

View File

@ -2,20 +2,21 @@
#
# Table name: checks
#
# id :bigint(8) not null, primary key
# active :boolean default(TRUE), not null
# comment :string(255)
# domain :string(255) not null
# domain_created_at :datetime
# domain_expires_at :datetime
# domain_updated_at :datetime
# kind :integer not null
# last_run_at :datetime
# last_success_at :datetime
# vendor :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint(8)
# id :bigint(8) not null, primary key
# active :boolean default(TRUE), not null
# comment :string(255)
# consecutive_failures :integer default(0), not null
# domain :string(255) not null
# domain_created_at :datetime
# domain_expires_at :datetime
# domain_updated_at :datetime
# kind :integer not null
# last_run_at :datetime
# last_success_at :datetime
# vendor :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint(8)
#
# Indexes
#

View File

@ -0,0 +1,5 @@
class AddConsecutiveFailuresToChecks < ActiveRecord::Migration[5.2]
def change
add_column :checks, :consecutive_failures, :integer, default: 0, null: false
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_06_13_055303) do
ActiveRecord::Schema.define(version: 2018_08_01_072038) do
create_table "check_logs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "check_id"
@ -38,6 +38,7 @@ ActiveRecord::Schema.define(version: 2018_06_13_055303) do
t.boolean "active", default: true, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "consecutive_failures", default: 0, null: false
t.index ["user_id"], name: "index_checks_on_user_id"
end

View File

@ -2,20 +2,21 @@
#
# Table name: checks
#
# id :bigint(8) not null, primary key
# active :boolean default(TRUE), not null
# comment :string(255)
# domain :string(255) not null
# domain_created_at :datetime
# domain_expires_at :datetime
# domain_updated_at :datetime
# kind :integer not null
# last_run_at :datetime
# last_success_at :datetime
# vendor :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint(8)
# id :bigint(8) not null, primary key
# active :boolean default(TRUE), not null
# comment :string(255)
# consecutive_failures :integer default(0), not null
# domain :string(255) not null
# domain_created_at :datetime
# domain_expires_at :datetime
# domain_updated_at :datetime
# kind :integer not null
# last_run_at :datetime
# last_success_at :datetime
# vendor :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint(8)
#
# Indexes
#
@ -39,6 +40,7 @@ FactoryBot.define do
comment nil
last_run_at nil
last_success_at nil
consecutive_failures 0
trait :domain do
kind :domain
@ -63,6 +65,7 @@ FactoryBot.define do
end
trait :last_runs_failed do
consecutive_failures 4
last_run_at 3.days.ago - 90.minutes
last_success_at 7.days.ago - 2.hours
end

View File

@ -2,20 +2,21 @@
#
# Table name: checks
#
# id :bigint(8) not null, primary key
# active :boolean default(TRUE), not null
# comment :string(255)
# domain :string(255) not null
# domain_created_at :datetime
# domain_expires_at :datetime
# domain_updated_at :datetime
# kind :integer not null
# last_run_at :datetime
# last_success_at :datetime
# vendor :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint(8)
# id :bigint(8) not null, primary key
# active :boolean default(TRUE), not null
# comment :string(255)
# consecutive_failures :integer default(0), not null
# domain :string(255) not null
# domain_created_at :datetime
# domain_expires_at :datetime
# domain_updated_at :datetime
# kind :integer not null
# last_run_at :datetime
# last_success_at :datetime
# vendor :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# user_id :bigint(8)
#
# Indexes
#