From 773a11b5e49058bf237345fbc9edb55523cbea3a Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 9 Sep 2021 22:55:02 +0300 Subject: [PATCH] db 62: remove duplicate currency entries before creating unique index --- app/src/main/res/raw/db_62.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/res/raw/db_62.sql b/app/src/main/res/raw/db_62.sql index c62609d8..6ac5f7c1 100644 --- a/app/src/main/res/raw/db_62.sql +++ b/app/src/main/res/raw/db_62.sql @@ -13,7 +13,7 @@ -- You should have received a copy of the GNU General Public License -- along with MoLe. If not, see . --- migrate from revision 60 to revision 61 +-- migrate from revision 61 to revision 62 -- pragmas need to be outside of transaction control -- foreign_keys is needed so that foreign key constraints are redirected @@ -23,4 +23,7 @@ pragma foreign_keys = on; begin transaction; +delete from currencies c +where id not in (select min(id) from currencies group by name); + create unique index currency_name_idx on currencies(name); \ No newline at end of file -- 2.39.5