data(safe_mailer): ajout d'un object permetant d'orienter les mails vers un unique fournisseur au cas ou l'autre soit down

This commit is contained in:
Martin 2023-01-11 09:37:26 +01:00 committed by LeSim
parent 733ba01695
commit 2f43ffc940
3 changed files with 28 additions and 1 deletions

18
app/models/safe_mailer.rb Normal file
View file

@ -0,0 +1,18 @@
# == Schema Information
#
# Table name: safe_mailers
#
# id :bigint not null, primary key
# forced_delivery_method :string
# created_at :datetime not null
# updated_at :datetime not null
#
class SafeMailer < ApplicationRecord
before_create do
raise if SafeMailer.count == 1
end
def self.forced_delivery_method
first&.forced_delivery_method
end
end

View file

@ -0,0 +1,9 @@
class CreateSafeMailers < ActiveRecord::Migration[6.1]
def change
create_table :safe_mailers do |t|
t.string :forced_delivery_method
t.timestamps
end
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: 2023_01_11_094621) do
ActiveRecord::Schema.define(version: 2023_01_10_181426) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"