Skip to content

WIP: Add abandoned_usernames table#14069

Draft
avirshup wants to merge 1 commit into
rust-lang:mainfrom
avirshup:abandoned_usernames_table
Draft

WIP: Add abandoned_usernames table#14069
avirshup wants to merge 1 commit into
rust-lang:mainfrom
avirshup:abandoned_usernames_table

Conversation

@avirshup

Copy link
Copy Markdown

This is the 1st of 2 prs to implement #13766. This probably shouldn't be merged to main until the full patch series is ready.

This PR adds the "abandoned_usernames" table, which will be used to track usernames that were once in "adopted" by an active user but were later "abandoned" (due to a username change or account deletion). The content of the table is based on the deleted_crates table, including an avaliable_at field for a cooldown period before the username can be used again.

(FYI, in the diff, it looks like diesel print-schema seems to have swapped the order of readme_renderings and recent_crate_downloads in schema.rs, I'm not quite sure why.)

@Turbo87 Turbo87 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably shouldn't be merged to main until the full patch series is ready.

I'm a bit hesitant to merge a new database table without it being used by anything, so yeah, I agree that we should probably wait with this until there is an actual user for this table.

View changes since this review

Comment thread migrations/2026-06-24-234807-0000_create_abandoned_usernames_table/up.sql Outdated
Comment thread migrations/2026-06-24-234807-0000_create_abandoned_usernames_table/up.sql Outdated
adopted_by INTEGER
CONSTRAINT fk_abandoned_usernames_adopted_by
REFERENCES users
ON DELETE SET NULL,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for context: currently we don't delete any users, we only set their username to "ghost" and delete all the personal information from their account. I guess technically the ON DELETE SET NULL shouldn't be necessary since we never delete. I currently don't remember what the default behavior is when you don't specify it. Does it prevent the user from getting deleted then? 🤔

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I currently don't remember what the default behavior is when you don't specify it. Does it prevent the user from getting deleted then?

Yeah, unless it has the ON DELETE clause, a foreign key constraint like this prevents dropping the referenced rows.

currently we don't delete any users, we only set their username to "ghost" and delete all the personal information from their account.

Ah, got it, thanks. Would your preference be to take out the ON DELETE SET NULL here, since it shouldn't matter? Alternatively I could just put in a comment saying that this is never expected to happen in normal circumstances.

@Turbo87
Turbo87 marked this pull request as draft June 26, 2026 05:06
@avirshup avirshup changed the title Add abandoned_usernames table WIP: Add abandoned_usernames table Jun 26, 2026
@avirshup

Copy link
Copy Markdown
Author

Thanks for your comments @Turbo87, I appreciate your time! I'll make the changes now, but will hold off on marking this as ready for review until discussion in the parent issue is complete, and I have the complete patch set ready.

@avirshup
avirshup force-pushed the abandoned_usernames_table branch 2 times, most recently from 8cedad5 to 76c4dc0 Compare June 28, 2026 00:13
@avirshup
avirshup force-pushed the abandoned_usernames_table branch from 76c4dc0 to b968b32 Compare July 13, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants