Skip to content

Remove the tokens table #1090

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
Oct 10, 2017
Merged

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Sep 26, 2017

This table was always one-to-one with the emails table, and we should
have always been updating it when the email was updated. This moves all
of that logic into the database, and merges the two tables.

The only reason that these tables were ever separate as far as I can
tell was to represent when the confirmation email hadn't been sent.
However, we can just do that with a nullable column.

However, having the token column leads to some awkward unwraps in
the code where we return it, since we know that updating the email
always generates a new token. For that reason I have made the token
column NOT NULL, but left the timestamp nullable. Rows in the emails
table that did not previously have an associated token row will have a
NULL value for this column.

@sgrif sgrif force-pushed the sg-rm-tokens-table branch 2 times, most recently from 462743a to a1475db Compare September 30, 2017 16:13
@sgrif
Copy link
Contributor Author

sgrif commented Oct 6, 2017

@carols10cents FYI I've got a branch updating to Diesel master (likely to represent 1.0 API-wise) ready to go, just blocked on this. Stuff like #1108 (and this, which is why I branched off this PR) will conflict heavily with it since we deprecated our existing APIs both for insert and upsert.

I'm fine with keeping it up to date as you review other stuff, but just wanted to let you know where I'm at

@carols10cents
Copy link
Member

Sorry sorry sorry. We need #1108 out before the release on thursday, so I'm going to merge and deploy that, then look at this.

@sgrif
Copy link
Contributor Author

sgrif commented Oct 6, 2017

Lol it's completely fine. No rush. Like I said, just wanted to let you know what's up

This table was always one-to-one with the emails table, and we should
have always been updating it when the email was updated. This moves all
of that logic into the database, and merges the two tables.

The only reason that these tables were ever separate as far as I can
tell was to represent when the confirmation email hadn't been sent.
However, we can just do that with a nullable column.

However, having the `token` column leads to some awkward `unwrap`s in
the code where we return it, since we know that updating the `email`
always generates a new token. For that reason I have made the `token`
column `NOT NULL`, but left the timestamp nullable. Rows in the `emails`
table that did not previously have an associated `token` row will have a
`NULL` value for this column.
@sgrif sgrif force-pushed the sg-rm-tokens-table branch from a1475db to 01bad8d Compare October 8, 2017 15:26
@carols10cents
Copy link
Member

Phew, had a chance to look at this, looks good! Diesel upgrade away!

bors: r+

bors-voyager bot added a commit that referenced this pull request Oct 10, 2017
1090: Remove the `tokens` table r=carols10cents

This table was always one-to-one with the emails table, and we should
have always been updating it when the email was updated. This moves all
of that logic into the database, and merges the two tables.

The only reason that these tables were ever separate as far as I can
tell was to represent when the confirmation email hadn't been sent.
However, we can just do that with a nullable column.

However, having the `token` column leads to some awkward `unwrap`s in
the code where we return it, since we know that updating the `email`
always generates a new token. For that reason I have made the `token`
column `NOT NULL`, but left the timestamp nullable. Rows in the `emails`
table that did not previously have an associated `token` row will have a
`NULL` value for this column.
@sgrif
Copy link
Contributor Author

sgrif commented Oct 10, 2017 via email

@bors-voyager
Copy link
Contributor

bors-voyager bot commented Oct 10, 2017

Build succeeded

@bors-voyager bors-voyager bot merged commit 01bad8d into rust-lang:master Oct 10, 2017
@sgrif sgrif deleted the sg-rm-tokens-table branch October 10, 2017 01:34
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.

3 participants