mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 07:01:42 +00:00
migraciones de produccion
This commit is contained in:
parent
6b985d778b
commit
04b0ca6200
2 changed files with 4 additions and 2 deletions
|
@ -1,9 +1,9 @@
|
||||||
class ChangeRefererToOrigin < ActiveRecord::Migration[6.0]
|
class ChangeRefererToOrigin < ActiveRecord::Migration[6.0]
|
||||||
def change
|
def change
|
||||||
rename_column :access_logs, :http_referer, :http_origin
|
|
||||||
|
|
||||||
return unless Rails.env.production?
|
return unless Rails.env.production?
|
||||||
|
|
||||||
|
rename_column :access_logs, :http_referer, :http_origin
|
||||||
|
|
||||||
# Eliminar todos los referers anteriores manteniendo el 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")
|
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
|
end
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
class AddCrawlerToAccessLogs < ActiveRecord::Migration[6.0]
|
class AddCrawlerToAccessLogs < ActiveRecord::Migration[6.0]
|
||||||
def change
|
def change
|
||||||
|
return unless Rails.env.production?
|
||||||
|
|
||||||
add_column :access_logs, :crawler, :boolean, default: false
|
add_column :access_logs, :crawler, :boolean, default: false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue