feat: Add better changes summary helper#2240
Conversation
| switch change.Type { | ||
| case TableColumnChangeTypeAdd: | ||
| if change.Current.PrimaryKey { | ||
| return fmt.Sprintf("Column %q added with type %q and primary key constraint", change.ColumnName, change.Current.Type) |
There was a problem hiding this comment.
What happens if a column has more than one property at the same time? (Incremental, not null. etc.)
Maybe add constraints as strings into a string slice and return a single line combining all with strings.Join
Column %q added with type %q and primary key constraint, not null constraint, as an incremental key
There was a problem hiding this comment.
Yeah thought about that, but I would say it's not interesting for the sake of the summary. If you have a new PK column it's "breaking enough" that we don't need to show the other changes
There was a problem hiding this comment.
A new PK is always not null and unique I think
There was a problem hiding this comment.
So these are always sorted in order of importance.
There was a problem hiding this comment.
So these are always sorted in order of importance.
In order of what I thought we should show first 🙃
🤖 I have created a release *beep* *boop* --- ## [4.88.0](v4.87.4...v4.88.0) (2025-07-28) ### Features * Add better changes summary helper ([#2240](#2240)) ([529532d](529532d)) ### Bug Fixes * **deps:** Update module google.golang.org/grpc to v1.74.1 ([#2238](#2238)) ([eeed6a6](eeed6a6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
#### Summary Follow up to cloudquery/plugin-sdk#2240 Example error ``` Loading spec(s) from examples/gcp_to_postgres.yml Starting migration for: gcp (cloudquery/gcp@v18.20.1) -> [postgresql (grpc@localhost:8888)] Error: failed to migrate v3 source gcp: rpc error: code = Internal desc = write failed: Can't migrate tables automatically, migrate manually or consider using 'migrate_mode: forced'. Non auto migratable tables changes: gcp_artifactregistry_docker_images: - Type changed from "list<item: utf8, nullable>" to "json" for column "tags" gcp_compute_routes: - Column "next_hop_inter_region_cost" added with type "int64" - Column "next_hop_med" added with type "int64" - Column "next_hop_origin" added with type "utf8" - Type changed from "list<item: utf8, nullable>" to "json" for column "tags" ```
Summary
Part of https://linear.app/cloudquery/issue/ENG-1828/feat-improved-forced-migration-needed-error-message.
Open for feedback, I tried to keep only the most interesting bit of each change. There's another improvement to be made and that's to pass only the breaking changes to the summary function (at the moment plugins print all changes which adds additional noise)
Before
After
Use the following steps to ensure your PR is ready to be reviewed
go fmtto format your code 🖊golangci-lint run🚨 (install golangci-lint here)