diff --git a/db/migrate/20210116165351_add_source_to_metadata_mappings.rb b/db/migrate/20210116165351_add_source_to_metadata_mappings.rb new file mode 100644 index 0000000..108a777 --- /dev/null +++ b/db/migrate/20210116165351_add_source_to_metadata_mappings.rb @@ -0,0 +1,5 @@ +class AddSourceToMetadataMappings < ActiveRecord::Migration[6.1] + def change + add_column :metadata_mappings, :source, :string, limit: 20 + end +end diff --git a/db/schema.rb b/db/schema.rb index 14f6400..9fb59b7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 diff --git a/lib/tasks/metadata_mappings_import.rake b/lib/tasks/metadata_mappings_import.rake index 6cd7afc..d147c98 100644 --- a/lib/tasks/metadata_mappings_import.rake +++ b/lib/tasks/metadata_mappings_import.rake @@ -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