Commit 529532d
authored
feat: Add better changes summary helper (#2240)
#### 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
```
Loading spec(s) from examples/gcp_to_postgres.yml
Starting migration for: gcp (cloudquery/[email protected]) -> [postgresql (cloudquery/[email protected])]
Error: failed to migrate v3 source gcp: rpc error: code = Internal desc = write failed: tables gcp_compute_routes,gcp_artifactregistry_docker_images with changes [[column: next_hop_inter_region_cost, type: add, current: next_hop_inter_region_cost:int64 column: next_hop_med, type: add, current: next_hop_med:int64 column: next_hop_origin, type: add, current: next_hop_origin:utf8 column: tags, type: update, current: tags:json, previous: tags:list<item: utf8, nullable>] [column: tags, type: update, current: tags:json, previous: tags:list<item: utf8, nullable>]] require migration. Migrate manually or consider using 'migrate_mode: forced'
```
## After
```
Loading spec(s) from examples/gcp_to_postgres.yml
Starting migration for: gcp (cloudquery/[email protected]) -> [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"
```
---1 parent eeed6a6 commit 529532d
1 file changed
+96
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
258 | 260 | | |
259 | 261 | | |
260 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
261 | 357 | | |
262 | 358 | | |
263 | 359 | | |
| |||
0 commit comments