Skip to content

feat(sqlite-migrate): Support PK changes to schema#7006

Merged
kodiakhq[bot] merged 4 commits intocloudquery:mainfrom
erezrokah:feat/sqlite_pk_migrate_support
Jan 24, 2023
Merged

feat(sqlite-migrate): Support PK changes to schema#7006
kodiakhq[bot] merged 4 commits intocloudquery:mainfrom
erezrokah:feat/sqlite_pk_migrate_support

Conversation

@erezrokah
Copy link
Copy Markdown
Member

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.

@erezrokah erezrokah requested review from a team and disq and removed request for a team January 23, 2023 10:09
@cq-bot cq-bot added the sqlite label Jan 23, 2023
@erezrokah erezrokah added the automerge Automatically merge once required checks pass label Jan 24, 2023
@kodiakhq kodiakhq bot merged commit dddd852 into cloudquery:main Jan 24, 2023
@erezrokah erezrokah deleted the feat/sqlite_pk_migrate_support branch January 24, 2023 09:19
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