Skip to content

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.

4 participants