Skip to content

Conversation

@Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Jun 4, 2025

There is no need for this function to use a transaction since the only place that this is used in production is already using an outer transaction.

It is also questionable whether the INSERT INTO versions_published_by needs to happen in the same function, since there are plenty of other inserts that need to happen when a new version is published, but neither of them are part of this function either.

In the effort of making crates_io_database an easy to reason about data access layer, this PR adjusts the NewVersion::save() fn to only save the new version to the versions table, and moves the versions_published_by insert code outside of the function.

Turbo87 added 4 commits June 4, 2025 10:57
…Version::save()` fn

This prepares for the "Trusted Publishing" implementation, where there is no associated user account for a release and thus no email address either. Moving the call outside of the transaction is fine since the only production code call is already happening in an outer transaction.
Now that we only perform a single database query in this function we don't need this transaction anymore. The only caller in production code is already using an outer transaction anyway.
…ublished_by::insert()` call

We don't need this in the database for the test cases in this module.
@Turbo87 Turbo87 added C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear A-backend ⚙️ labels Jun 4, 2025
@Turbo87 Turbo87 merged commit 19759c7 into rust-lang:main Jun 4, 2025
10 checks passed
@Turbo87 Turbo87 deleted the version-save branch June 4, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant