mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 15:18:34 +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.
29 lines
775 B
Ruby
Vendored
29 lines
775 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
class DoNotDisturbTiming < ActiveRecord::Base
|
|
belongs_to :user
|
|
|
|
validate :ends_at_greater_than_starts_at
|
|
|
|
def ends_at_greater_than_starts_at
|
|
errors.add(:ends_at, :invalid) if starts_at > ends_at
|
|
end
|
|
end
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: do_not_disturb_timings
|
|
#
|
|
# id :bigint not null, primary key
|
|
# ends_at :datetime not null
|
|
# scheduled :boolean default(FALSE)
|
|
# starts_at :datetime not null
|
|
# user_id :integer not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_do_not_disturb_timings_on_ends_at (ends_at)
|
|
# index_do_not_disturb_timings_on_scheduled (scheduled)
|
|
# index_do_not_disturb_timings_on_starts_at (starts_at)
|
|
# index_do_not_disturb_timings_on_user_id (user_id)
|
|
#
|