Skip to content

[2.x] fix(realtime): order users by joined_at in realtime:info#4630

Merged
imorland merged 1 commit into
2.xfrom
im/realtime-info-joined-at
May 6, 2026
Merged

[2.x] fix(realtime): order users by joined_at in realtime:info#4630
imorland merged 1 commit into
2.xfrom
im/realtime-info-joined-at

Conversation

@imorland

@imorland imorland commented May 6, 2026

Copy link
Copy Markdown
Member

Summary

php flarum realtime:info failed with Unknown column 'created_at' in 'order clause' because the command used Eloquent's oldest() without arguments — which defaults to a created_at column that Flarum's users table doesn't have. Flarum uses joined_at instead.

Fixes #4617

Changes

This is the only place in the framework that hits this pattern (verified via grep).

Why not override CREATED_AT on User or AbstractModel

  • AbstractModel is the base for every Flarum model — most use created_at, only User uses joined_at. There's no single column name that fits all.
  • Setting const CREATED_AT = 'joined_at' on User would help future callers but makes the model look like it has Eloquent-style timestamps when it doesn't ($timestamps = false). Risk of confusing third-party code that introspects the model.
  • The targeted fix at the call site is clearer about what the code wants (oldest user by join date) and matches Flarum's existing convention everywhere else.

Test plan

  • Manually verified php flarum realtime:info runs to completion in the dev container.
  • No automated test added — the command depends on a live Pusher connection, so writing one would require heavy mocking for a one-line fix.

Eloquent's oldest() defaults to a created_at column, but Flarum's users
table uses joined_at. The realtime:info command failed with
"Unknown column 'created_at' in 'order clause'".

Pass 'joined_at' explicitly to match the schema.

Fixes #4617
@imorland imorland requested a review from a team as a code owner May 6, 2026 18:53
@imorland imorland added this to the 2.0.0-rc.2 milestone May 6, 2026
@imorland imorland merged commit a3f8fc4 into 2.x May 6, 2026
25 checks passed
@imorland imorland deleted the im/realtime-info-joined-at branch May 6, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

realtime:info fails because it orders Flarum users by Laravel's default created_at column

1 participant