-
Notifications
You must be signed in to change notification settings - Fork 4.1k
chore(usage): Improving user tracking #9873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,41 @@ | ||||||
| """add per-user usage counters | ||||||
|
|
||||||
| Revision ID: a3f2c8e91b04 | ||||||
| Revises: d8cdfee5df80 | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The docstring says
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: backend/alembic/versions/a3f2c8e91b04_add_user_usage_counters.py
Line: 4
Comment:
**Migration docstring `Revises` doesn't match `down_revision`**
The docstring says `Revises: d8cdfee5df80`, but the actual code sets `down_revision = "8188861f4e92"`. Alembic uses the variable, not the docstring, so the migration chain works correctly — but the discrepancy is confusing when reading the history.
```suggestion
Revises: 8188861f4e92
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||
| Create Date: 2026-04-01 18:00:00.000000 | ||||||
|
|
||||||
| """ | ||||||
|
|
||||||
| from alembic import op | ||||||
| import sqlalchemy as sa | ||||||
|
|
||||||
|
|
||||||
| # revision identifiers, used by Alembic. | ||||||
| revision = "a3f2c8e91b04" | ||||||
| down_revision = "8188861f4e92" | ||||||
| branch_labels = None | ||||||
| depends_on = None | ||||||
|
|
||||||
|
|
||||||
| def upgrade() -> None: | ||||||
| op.create_table( | ||||||
| "user_usage_counter", | ||||||
| sa.Column("id", sa.Integer(), primary_key=True), | ||||||
| sa.Column( | ||||||
| "user_id", | ||||||
| sa.Uuid(), | ||||||
| sa.ForeignKey("user.id", ondelete="CASCADE"), | ||||||
| nullable=False, | ||||||
| ), | ||||||
| sa.Column("counter_key", sa.String(64), nullable=False), | ||||||
| sa.Column("current_value", sa.Integer(), nullable=False, server_default="0"), | ||||||
| sa.Column("target_value", sa.Integer(), nullable=False), | ||||||
| sa.Column("completed_at", sa.DateTime(timezone=True), nullable=True), | ||||||
| sa.Column("acknowledged", sa.Boolean(), nullable=False, server_default="false"), | ||||||
| sa.UniqueConstraint("user_id", "counter_key", name="uq_user_usage_counter"), | ||||||
| sa.Index("ix_user_usage_counter_user_id", "user_id"), | ||||||
| ) | ||||||
|
|
||||||
|
|
||||||
| def downgrade() -> None: | ||||||
| op.drop_table("user_usage_counter") | ||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The migration doc header has the wrong
Revisesvalue and does not matchdown_revision, which makes the migration history misleading during debugging and operational review.Prompt for AI agents