21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-04 09:45:09 +02:00

[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 # Table name: checks
# #
# id :bigint(8) not null, primary key # id :bigint(8) not null, primary key
# active :boolean default(TRUE), not null # active :boolean default(TRUE), not null
# comment :string(255) # comment :string(255)
# domain :string(255) not null # consecutive_failures :integer default(0), not null
# domain_created_at :datetime # domain :string(255) not null
# domain_expires_at :datetime # domain_created_at :datetime
# domain_updated_at :datetime # domain_expires_at :datetime
# kind :integer not null # domain_updated_at :datetime
# last_run_at :datetime # kind :integer not null
# last_success_at :datetime # last_run_at :datetime
# vendor :string(255) # last_success_at :datetime
# created_at :datetime not null # vendor :string(255)
# updated_at :datetime not null # created_at :datetime not null
# user_id :bigint(8) # updated_at :datetime not null
# user_id :bigint(8)
# #
# Indexes # 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. # 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| create_table "check_logs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "check_id" 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.boolean "active", default: true, null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_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" t.index ["user_id"], name: "index_checks_on_user_id"
end end

View file

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

View file

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