Skip to content

Preparation to drop email in User in Rust codes #1911

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
Nov 25, 2019
Merged

Preparation to drop email in User in Rust codes #1911

merged 1 commit into from
Nov 25, 2019

Conversation

hbina
Copy link
Contributor

@hbina hbina commented Nov 21, 2019

Related: #1888

This commit(s) prepares the migration to dropping email column from the User table.
Here, I introduce a new intermediate type called UserNoEmailType.

Copied from my latest commit:

Every queries out of User'stable should now be converted into an intermediate type called UserNoEmailType.
This is done by selecting only the appropriate columns which is defined in user::ALL_COLUMNS (notice that it excludes email)
This could be renamed, I guess.
Conversion from this type to User is simply a copy except that email returned will always be None.

I think its possible to remove email from User directly because its not actually the mirror of User's table.
The mirror struct is actually NewUser.

@rust-highfive
Copy link

r? @smarnach

(rust_highfive has picked a reviewer for you, use r? to override)

@bors
Copy link
Contributor

bors commented Nov 22, 2019

☔ The latest upstream changes (presumably #1901) made this pull request unmergeable. Please resolve the merge conflicts.

@hbina hbina changed the title Remove email from user struct Preparation to drop email from Rust codes Nov 22, 2019
@hbina hbina changed the title Preparation to drop email from Rust codes Preparation to drop email in User in Rust codes Nov 22, 2019
Copy link
Member

@carols10cents carols10cents left a comment

Choose a reason for hiding this comment

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

Very close!! There's just one comment I think isn't needed anymore; mind removing that?

Thank you so much!!!

@@ -220,18 +222,21 @@ pub fn reverse_dependencies(req: &mut dyn Request) -> CargoResult<Response> {

let version_ids: Vec<i32> = rev_deps.iter().map(|dep| dep.version_id).collect();

// FIXME :: Another one of these silly transformation that is necessary to test
// whether or not this function uses the column email from the user
// table. Here, we simply set it to None.
Copy link
Member

Choose a reason for hiding this comment

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

Does this comment still apply, since the transformation it's talking about was removed in ea51376?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, I don't think this applies anymore. Do you want me to merge these commits into one?

@bors
Copy link
Contributor

bors commented Nov 25, 2019

☔ The latest upstream changes (presumably #1909) made this pull request unmergeable. Please resolve the merge conflicts.

Every queries out of `User`'stable should now be converted into an
intermediate type called `UserNoEmailType` (could be renamed, I
guess). Conversion from this type to `User` is simply a copy except
that `email` returned will always be `None`.

I think its possible to remove `email` from User directly because
its not actually the mirror of `User`'s table (the mirror struct is actually
`NewUser`
@carols10cents
Copy link
Member

Thank you so much! I introduced some conflicts by merging some other PRs, so I resolved those and squashed for you while I was in there. Great work!!

@bors r+

@bors
Copy link
Contributor

bors commented Nov 25, 2019

📌 Commit 3af1934 has been approved by carols10cents

bors added a commit that referenced this pull request Nov 25, 2019
…cents

Preparation to drop `email` in User in Rust codes

Related: #1888

This commit(s) prepares the migration to dropping `email` column from the `User` table.
Here, I introduce a new intermediate type called `UserNoEmailType`.

Copied from my latest commit:

Every queries out of `User`'stable should now be converted into an intermediate type called `UserNoEmailType`.
This is done by selecting only the appropriate columns which is defined in `user::ALL_COLUMNS` (notice that it excludes `email`)
This could be renamed, I guess.
Conversion from this type to `User` is simply a copy except that `email` returned will always be `None`.

I think its possible to remove `email` from User directly because its not actually the mirror of `User`'s table.
The mirror struct is actually `NewUser`.
@bors
Copy link
Contributor

bors commented Nov 25, 2019

⌛ Testing commit 3af1934 with merge 92edac3...

@bors
Copy link
Contributor

bors commented Nov 25, 2019

☀️ Test successful - checks-travis
Approved by: carols10cents
Pushing 92edac3 to master...

@bors bors merged commit 3af1934 into rust-lang:master Nov 25, 2019
carols10cents added a commit to integer32llc/crates.io that referenced this pull request Nov 25, 2019
…truct, r=carols10cents"

This reverts commit 92edac3, reversing
changes made to 4df7001.
bors added a commit that referenced this pull request Nov 25, 2019
Revert "Auto merge of #1911 - hbina:remove_email_from_user_struct, r=…

…carols10cents"

This reverts commit 92edac3, reversing
changes made to 4df7001.

I missed a spot when reviewing #1911. This reverts that merge so that master is deployable again; I'm going to self-r+ this and then open a new PR with #1911 and a fix on it and have someone else review that.
@hbina
Copy link
Contributor Author

hbina commented Nov 25, 2019

Thank you!

@hbina hbina deleted the remove_email_from_user_struct branch November 25, 2019 17:46
bors added a commit that referenced this pull request Nov 26, 2019
Missed a conversion from UserNoEmailType to User

When reviewing #1911, I missed a spot. I reverted the PR merge on master, so this PR reverts the revert and adds the fix.

I tried to write a test that would have caught this, but I utterly failed at making a real-enough app/request that would have `.user()` but would let me set the `session()` :(

Also a lot of this code is temporary and will be undone once I've rebased #1891, but this needs to be deployed separately from #1891 to ensure there aren't any uses of the email column.

r? @jtgeibel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants