Skip to content

Remove unused crate_owner_invitations.token_generated_at column #10548

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

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions crates/crates_io_database/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,6 @@ diesel::table! {
///
/// (Automatically generated by Diesel.)
token -> Text,
/// The `token_generated_at` column of the `crate_owner_invitations` table.
///
/// Its SQL type is `Nullable<Timestamp>`.
///
/// (Automatically generated by Diesel.)
token_generated_at -> Nullable<Timestamp>,
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/crates_io_database_dump/src/dump-db.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ invited_by_user_id = "private"
crate_id = "private"
created_at = "private"
token = "private"
token_generated_at = "private"

[crate_owners]
dependencies = ["crates", "users"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ALTER TABLE crate_owner_invitations ADD COLUMN token_generated_at TIMESTAMP;

CREATE FUNCTION crate_owner_invitations_set_token_generated_at() RETURNS trigger AS $$
BEGIN
NEW.token_generated_at := CURRENT_TIMESTAMP;
RETURN NEW;
END
$$ LANGUAGE plpgsql;

CREATE TRIGGER trigger_crate_owner_invitations_set_token_generated_at BEFORE
INSERT OR UPDATE OF token ON crate_owner_invitations
FOR EACH ROW EXECUTE PROCEDURE crate_owner_invitations_set_token_generated_at();
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DROP TRIGGER trigger_crate_owner_invitations_set_token_generated_at ON crate_owner_invitations;
DROP FUNCTION crate_owner_invitations_set_token_generated_at();
ALTER TABLE crate_owner_invitations DROP COLUMN token_generated_at;
1 change: 0 additions & 1 deletion src/models/crate_owner_invitation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub struct CrateOwnerInvitation {
pub created_at: NaiveDateTime,
#[diesel(deserialize_as = String)]
pub token: SecretString,
pub token_created_at: Option<NaiveDateTime>,
}

impl CrateOwnerInvitation {
Expand Down