[MIG] Added checks#mode as an enum (auto, manual)

This commit is contained in:
Colin Darie 2018-08-29 16:31:13 +02:00
parent 57b24e5e29
commit 18cccf9790
No known key found for this signature in database
GPG Key ID: 4FB865FDBCA4BCC4
4 changed files with 11 additions and 3 deletions

View File

@ -1,6 +1,5 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Jeremy Lecour <jlecour@evolix.fr>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
# == Schema Information
#
# Table name: checks
@ -16,6 +15,7 @@
# kind :integer not null
# last_run_at :datetime
# last_success_at :datetime
# mode :integer default("auto"), not null
# vendor :string(255)
# created_at :datetime not null
# updated_at :datetime not null
@ -39,6 +39,7 @@ class Check < ApplicationRecord
reject_if: lambda { |at| at["recipient"].blank? && at["interval"].blank? }
enum kind: [:domain, :ssl]
enum mode: [:auto, :manual]
self.skip_time_zone_conversion_for_attributes = [
:domain_created_at,

View File

@ -0,0 +1,5 @@
class AddModeToChecks < ActiveRecord::Migration[5.2]
def change
add_column :checks, :mode, :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_08_01_072038) do
ActiveRecord::Schema.define(version: 2018_08_29_134404) do
create_table "check_logs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.bigint "check_id"
@ -39,6 +39,7 @@ ActiveRecord::Schema.define(version: 2018_08_01_072038) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "consecutive_failures", default: 0, null: false
t.integer "mode", default: 0, null: false
t.index ["user_id"], name: "index_checks_on_user_id"
end

View File

@ -1,6 +1,5 @@
# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
# == Schema Information
#
# Table name: checks
@ -16,6 +15,7 @@
# kind :integer not null
# last_run_at :datetime
# last_success_at :datetime
# mode :integer default("auto"), not null
# vendor :string(255)
# created_at :datetime not null
# updated_at :datetime not null
@ -44,6 +44,7 @@ FactoryBot.define do
last_run_at nil
last_success_at nil
consecutive_failures 0
mode :auto
trait :domain do
kind :domain