agrosner / DBFlow

A blazing fast, powerful, and very simple ORM android database library that writes database code for you.
MIT License
4.87k stars 598 forks source link

Remove column's unique by contentdatabase Migration #1713

Open wangsuicheng opened 3 years ago

wangsuicheng commented 3 years ago

DBFlow Version: 4.2

Desc: Some columns has unique annotation, how to remove it at next migration

agrosner commented 3 years ago

You have to stream the old table into a new table using a Migration. Please refer to https://www.sqlite.org/lang_altertable.html for supported alter table types. We do support Table-less models via createWithDatabase = false on the Table annotation. i would make a new model that represents the old version (with Unique) then read that out of a db on migration for old version, then insert the data into the new table with the original model (and remove @Unique from that model).