]> git.ktnx.net Git - mobile-ledger.git/blob - app/src/main/res/raw/sql_9.sql
let SQL revision files control the transaction
[mobile-ledger.git] / app / src / main / res / raw / sql_9.sql
1 -- Copyright © 2018 Damyan Ivanov.
2 -- This file is part of MoLe.
3 -- MoLe is free software: you can distribute it and/or modify it
4 -- under the term of the GNU General Public License as published by
5 -- the Free Software Foundation, either version 3 of the License, or
6 -- (at your opinion), any later version.
7 --
8 -- MoLe is distributed in the hope that it will be useful,
9 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
10 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 -- GNU General Public License terms for details.
12 --
13 -- You should have received a copy of the GNU General Public License
14 -- along with MoLe. If not, see <https://www.gnu.org/licenses/>.
15
16 BEGIN TRANSACTION;
17
18 alter table transactions add keep boolean default 1 not null;
19 update transactions set keep = 1;
20 create table transactions_new(id integer, date varchar, description varchar, data_hash varchar, keep boolean);
21 insert into transactions_new(id, date, description, data_hash, keep) select cast(id as integer), date, description, data_hash, keep from transactions;
22 drop table transactions;
23 create table transactions(id integer primary key, date varchar, description varchar, data_hash varchar, keep boolean);
24 create unique index un_transactions_data_hash on transactions(data_hash);
25 insert into transactions(id, date, description, data_hash, keep) select id, date, description, data_hash, keep from transactions_new;
26 drop table transactions_new;
27
28 COMMIT TRANSACTION;