discourse/db/migrate/20250304034313_add_composer_columns_to_post_stat.rb
Martin Brennan 223b40de1c
FEATURE: Store composer version and device info on post stat (#31600)
We are developing our new composer, and it would be useful
if we could know how posts are being created by members.

To this end, we are going to start storing the following
on post_stats, which are created at the same time as a post
is created:

* writing_device - Based on `BrowserDetection.device`, which in
  turn is based on user agent. Will store .e.g iphone, android,
  mac, windows etc.
* writing_user_agent - Stores the full user agent (truncated at
  400 chars) of the device/browser the member used to write the post.
* composer_version - Either `1` for our old composer, or
  `2` if the new rich composer is enabled in site settings and
  the user has toggled it on
2025-03-05 12:48:32 +10:00

9 lines
293 B
Ruby

# frozen_string_literal: true
class AddComposerColumnsToPostStat < ActiveRecord::Migration[7.2]
def change
add_column :post_stats, :composer_version, :integer
add_column :post_stats, :writing_device, :string
add_column :post_stats, :writing_device_user_agent, :string
end
end