Skip to content

feat(sqlite): Support force migration#6763

Merged
kodiakhq[bot] merged 8 commits intocloudquery:mainfrom
erezrokah:feat/sqlite_add_force_migrate
Jan 19, 2023
Merged

feat(sqlite): Support force migration#6763
kodiakhq[bot] merged 8 commits intocloudquery:mainfrom
erezrokah:feat/sqlite_add_force_migrate

Conversation

@erezrokah
Copy link
Copy Markdown
Member

Summary

To be merged after #6759, and needs cloudquery/plugin-sdk#604

@erezrokah erezrokah requested review from a team and disq and removed request for a team January 12, 2023 15:23
@cq-bot cq-bot added the sqlite label Jan 12, 2023
@erezrokah erezrokah force-pushed the feat/sqlite_add_force_migrate branch from 9993606 to 011fae1 Compare January 12, 2023 15:38
@erezrokah erezrokah force-pushed the feat/sqlite_add_force_migrate branch from 011fae1 to 06a6729 Compare January 15, 2023 16:40
erezrokah added a commit to cloudquery/plugin-sdk that referenced this pull request Jan 15, 2023
#### Summary

<!-- 🎉 Thank you for making CloudQuery awesome by submitting a PR 🎉 -->

Related to cloudquery/cloudquery#6600, needed
for cloudquery/cloudquery#6763

---

Use the following steps to ensure your PR is ready to be reviewed

- [ ] Read the [contribution guidelines](../blob/main/CONTRIBUTING.md)
🧑‍🎓
- [ ] Run `go fmt` to format your code 🖊
- [ ] Lint your changes via `golangci-lint run` 🚨 (install golangci-lint
[here](https://golangci-lint.run/usage/install/#local-installation))
- [ ] Update or add tests 🧪
- [ ] Ensure the status checks below are successful ✅
@erezrokah erezrokah force-pushed the feat/sqlite_add_force_migrate branch 2 times, most recently from c7b7af2 to af35c3d Compare January 19, 2023 13:31
@erezrokah erezrokah added the automerge Automatically merge once required checks pass label Jan 19, 2023
@kodiakhq kodiakhq bot merged commit 19bba77 into cloudquery:main Jan 19, 2023
kodiakhq bot pushed a commit that referenced this pull request Jan 24, 2023

#### Summary

Related to #6600, #6763 and #6759

This PR adds support for PK changes migration. Before we would just ignore them, so the following use cases were ignored:
1. Adding a new column as a primary key -> The column was added, but the table PKs were left unchanged
2. Removing a PK from an existing column -> Was ignored
3. Adding a PK to an existing column -> Was ignored
4. Changing the type of an existing PK column -> Was handled by a regular non PK column type change. We dropped the column, but we need to drop the table.

SQLite is quite limited in what can be done with PK changes. On any PK change we need to recreate the table, so either `drop + create` or `create new + copy old to new + drop old + rename new`.
I went with the former for simplicity.

<!--
kodiakhq bot pushed a commit that referenced this pull request Jan 24, 2023
🤖 I have created a release *beep* *boop*
---


## [1.2.0](plugins-destination-sqlite-v1.1.6...plugins-destination-sqlite-v1.2.0) (2023-01-24)


### Features

* **sqlite-migrate:** Support PK changes to schema ([#7006](#7006)) ([dddd852](dddd852))
* **sqlite:** Collect and report migration errors before starting the migration ([#6759](#6759)) ([a80e9d9](a80e9d9))
* **sqlite:** Support force migration ([#6763](#6763)) ([19bba77](19bba77))


### Bug Fixes

* **deps:** Update module github.com/cloudquery/plugin-sdk to v1.28.0 ([#7009](#7009)) ([12ac005](12ac005))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants