Ajout d'une source pour les MetadataMapping
Ça aidera à faire du nettoyage, par exemple sur ce qui vient automatiquement de LDAP.
This commit is contained in:
parent
02a51121e3
commit
f991f5d35b
|
@ -0,0 +1,5 @@
|
|||
class AddSourceToMetadataMappings < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :metadata_mappings, :source, :string, limit: 20
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_01_06_221142) do
|
||||
ActiveRecord::Schema.define(version: 2021_01_16_165351) do
|
||||
|
||||
create_table "action_mailbox_inbound_emails", force: :cascade do |t|
|
||||
t.integer "status", default: 0, null: false
|
||||
|
@ -73,6 +73,7 @@ ActiveRecord::Schema.define(version: 2021_01_06_221142) do
|
|||
t.string "entity"
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.string "source", limit: 20
|
||||
t.index ["input"], name: "index_metadata_mappings_on_input"
|
||||
end
|
||||
|
||||
|
|
|
@ -55,10 +55,10 @@ namespace :metadata_mappings do
|
|||
end
|
||||
|
||||
metadata.each do |input, meta|
|
||||
mapping = MetadataMapping.find_or_initialize_by(input: input) { |record|
|
||||
record.server = meta[:server]
|
||||
record.entity = meta[:entity]
|
||||
}
|
||||
mapping = MetadataMapping.find_or_initialize_by(input: input)
|
||||
mapping.server = meta[:server]
|
||||
mapping.entity = meta[:entity]
|
||||
mapping.source = :ldap
|
||||
mapping.save
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue