Skip to content

Update migrations - add contributors url #18

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

VishakhaSainani-Josh
Copy link
Collaborator

Update migrations- need to add contributors_url in repository table to use the url later for fetching contributors.

Comment on lines 1 to 5
ALTER TABLE repositories ADD COLUMN contributors_url VARCHAR(255);

UPDATE repositories SET contributors_url = '' WHERE contributors_url IS NULL;

ALTER TABLE repositories ALTER COLUMN contributors_url SET NOT NULL;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we do as below?

ALTER TABLE repositories ADD COLUMN contributors_url VARCHAR(255) DEFAULT '';

Also I would be good to have only 1 alter table per migration.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Even though both are related and it is just setting the added column as null. So for that also I should do separate migrations?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, we should ideally keep 1 statement per migration file. So that migration roll back can easily be done in case of errors.

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