Add a table for reserved usernames similar to reserved crate names
[In the same manner as `reserved_crate_names`](https://github.com/rust-lang/crates.io/blob/07920c13aa8d428105fa2ea6fc1cf74e803775b8/migrations/20170305095748_create_reserved_crate_names/up.sql), write a database migration that:
- creates a table named `reserved_usernames`
- creates a function named `ensure_username_not_reserved`
- uses the `ensure_username_not_reserved` function in a trigger on user record insert or update
- does NOT add initial values to the table; crates.io admins will take care of that
This table can be [publicly available in the database dump like `reserved_crate_names` is](https://github.com/rust-lang/crates.io/blob/07920c13aa8d428105fa2ea6fc1cf74e803775b8/crates/crates_io_database_dump/src/dump-db.toml#L196-L197).
Once this is deployed, crates.io admins should manually populate this table using the `reserved_crate_names` table as inspiration.
1 条评论