Skip to content
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

sql/postgres: add missing comma in column changes for reverse changes in Postgres #668

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

tprebs
Copy link
Contributor

@tprebs tprebs commented Mar 23, 2022

Adds the missing comma when generating reverse changes on columns. #667

This change just adds the comma the same way it has been done for other changes and in the mysql migration but it doesn't feel right to have to manually add the comma in when generating the reverse sql when it is done automatically by MapComma for alter table cmd.

Would it make more sense to either split the logic for reverse out into a second iteration via reversible.MapComma create a wrapper struct which exposes both builders to the existing code e.g. rb.MapComma(changes, func(i int, b *sqlx.Builder, rb *sqlx.Builder)) This would mean in the future the logic for applying commas is standard between the generation of the cmd and reverse

Copy link
Member

@a8m a8m left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @tprebs.

Regarding your suggestion, I agree it can be improved. I'll try to think of a solution for this.

@a8m a8m merged commit c78427f into ariga:master Mar 24, 2022
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.

2 participants