From: Damyan Ivanov Date: Thu, 9 Sep 2021 19:55:02 +0000 (+0300) Subject: db 62: remove duplicate currency entries before creating unique index X-Git-Tag: v0.20.1~2 X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=commitdiff_plain;h=773a11b5e49058bf237345fbc9edb55523cbea3a db 62: remove duplicate currency entries before creating unique index --- 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