diff --git a/db/migrate/20200801230101_change_referer_to_origin.rb b/db/migrate/20200801230101_change_referer_to_origin.rb index 6440e7b..8c63ed3 100644 --- a/db/migrate/20200801230101_change_referer_to_origin.rb +++ b/db/migrate/20200801230101_change_referer_to_origin.rb @@ -1,9 +1,9 @@ class ChangeRefererToOrigin < ActiveRecord::Migration[6.0] def change - rename_column :access_logs, :http_referer, :http_origin - return unless Rails.env.production? + rename_column :access_logs, :http_referer, :http_origin + # Eliminar todos los referers anteriores manteniendo el origin ActiveRecord::Base.connection.execute("update access_logs set http_origin = split_part(http_origin, '/', 1) || '//' || split_part(http_origin, '/', 3) where http_origin is not null") end diff --git a/db/migrate/20200801233025_add_crawler_to_access_logs.rb b/db/migrate/20200801233025_add_crawler_to_access_logs.rb index 43d48ad..47c2979 100644 --- a/db/migrate/20200801233025_add_crawler_to_access_logs.rb +++ b/db/migrate/20200801233025_add_crawler_to_access_logs.rb @@ -1,5 +1,7 @@ class AddCrawlerToAccessLogs < ActiveRecord::Migration[6.0] def change + return unless Rails.env.production? + add_column :access_logs, :crawler, :boolean, default: false end end