5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 22:36:21 +00:00
panel/db/migrate/20200801230101_change_referer_to_origin.rb

11 lines
438 B
Ruby
Raw Normal View History

2020-08-01 23:13:09 +00:00
class ChangeRefererToOrigin < ActiveRecord::Migration[6.0]
def change
2020-08-07 14:15:06 +00:00
return unless Rails.env.production?
2020-08-18 13:17:13 +00:00
rename_column :access_logs, :http_referer, :http_origin
2020-08-01 23:13:09 +00:00
# Eliminar todos los referers anteriores manteniendo el origin
2020-08-01 23:22:32 +00:00
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")
2020-08-01 23:13:09 +00:00
end
end