mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-14 23:27:06 +08:00
`.annotaterb.yml` has carried `classified_sort: true` since the project
switched from `annotate` to `annotaterb` (commit 0eab7daea4, July 2025),
but annotaterb's default behaviour is to compare the existing schema
block against what it would generate and skip the rewrite when the
column list matches — even when the *ordering* of those columns differs.
The result is that models which haven't had a schema change since the
config landed never get reordered, and `classified_sort` drift
accumulates indefinitely.
`--force` makes annotaterb always rewrite, so a single `bin/rake
annotate:clean` run brings every model into the canonical format and
keeps them there. Every schema block is now grouped primary-key →
regular columns → timestamps → foreign keys (alphabetical within each
group). Pure annotation comment change — no code modifications.
Also cleans up the rake task to avoid string interpolation for `system`
calls.
36 lines
1.1 KiB
Ruby
36 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class PostStat < ActiveRecord::Base
|
|
# Version 1 is the original textarea composer for Discourse,
|
|
# which has been around since its inception and uses a split
|
|
# pane between markdown and preview.
|
|
#
|
|
# Version 2 is the new rich text composer, which is a single
|
|
# contendedibale using ProseMirror which is more of a WYSIWYG
|
|
# experience.
|
|
COMPOSER_VERSIONS = { 1 => "classic", 2 => "rich_text" }
|
|
|
|
belongs_to :post
|
|
end
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: post_stats
|
|
#
|
|
# id :integer not null, primary key
|
|
# composer_open_duration_msecs :integer
|
|
# composer_version :integer
|
|
# drafts_saved :integer
|
|
# typing_duration_msecs :integer
|
|
# writing_device :string
|
|
# writing_device_user_agent :string
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
# post_id :integer
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_post_stats_on_composer_version (composer_version)
|
|
# index_post_stats_on_post_id (post_id)
|
|
# index_post_stats_on_writing_device (writing_device)
|
|
#
|