-
Notifications
You must be signed in to change notification settings - Fork 308
Updated schema for emails.participant to refer to participants.id #3864
Conversation
cc: @rohitpaulk @rorepo |
@@ -0,0 +1,9 @@ | |||
ALTER TABLE emails DROP CONSTRAINT emails_participant_fkey; | |||
|
|||
ALTER TABLE emails ALTER COLUMN participant TYPE bigint USING participant::bigint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the effect of the participant::bigint
cast? Does this properly convert the values in the emails.participant
column?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The participants.id
datatype is bigserial
. So, the datatype of emails.participant
need to match with this. In order to do so, we need to first convert it into bigint
and then create a sequence for the column. We can read more about serial type from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to the old data in the column with this statement?
I think this can be done in a better fashion. If we try to couple application code changes and database migrations (such that they both have to be made at once), we're going to require a certain amount of downtime - And if we end up with errors in the migration code, that could be a lot of downtime. If we incrementally make changes to the application and schema, such that they don't trample over each other - this whole operation would be much safer. Here's how I think this can be done -
Does that make sense, @sammyshj? |
Ping @sammyshj. Are you stuck here? Can we help you get unstuck? :-) |
@rohitpaulk is the idea of speeding up the migrations still live to deserve a new ticket? |
I think you're getting confused with two different migrations here, @techtonik. Seemed like you were talking about #3894? To clear things up - #3894 deals with speeding up the tip migration script that we run every Payday. When users who previously had tips on Gratipay create Teams - we migrate their tips over (and create #835 is what this PR is related to, it deals with replacing |
I see that #835 is already implemented in 3 PRs. Unused |
@techtonik the unused |
@aandis yea, I saw that. Just a thought that now data dump is not as convenient to for human consumption as it was. |
Changes made in this PR:
sql/branch.sql
. Theemails.participant
now refers toparticipants.id
rather thanparticipants.username
.@whit537 , the tests fail now as the schema is now changed. Please let me know if the schema change looks good and I will move ahead with fixing the tests.