]> git.ktnx.net Git - mobile-ledger.git/blob - app/src/main/res/raw/sql_13.sql
add missing/fix copyright statements to all SQL revision files
[mobile-ledger.git] / app / src / main / res / raw / sql_13.sql
1 -- Copyright © 2019 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 delete from options where name='transaction_list_last_update';
17 delete from options where name='last_refresh';
18 alter table options add profile varchar;
19 drop index idx_options_name;
20 create unique index un_options on options(profile,name);
21 --
22 drop table account_values;
23 create table account_values(profile varchar not null, account varchar not null, currency varchar not null default '', keep boolean, value decimal not null );
24 create unique index un_account_values on account_values(profile,account,currency);
25 --
26 drop table accounts;
27 create table accounts(profile varchar not null, name varchar not null, name_upper varchar not null, hidden boolean not null default 0, keep boolean not null default 0, level integer not null, parent_name varchar);
28 create unique index un_accounts on accounts(profile, name);
29 --
30 drop table transaction_accounts;
31 drop table transactions;
32 --
33 create table transactions(id integer not null, data_hash varchar not null, date varchar not null, description varchar not null, keep boolean not null default 0);
34 create unique index un_transactions_id on transactions(id);
35 create unique index un_transactions_data_hash on transactions(data_hash);
36 --
37 create table transaction_accounts(profile varchar not null, transaction_id integer not null, account_name varchar not null, currency varchar not null default '', amount decimal not null, constraint fk_transaction_accounts_acc foreign key(profile,account_name) references accounts(profile,account_name), constraint fk_transaction_accounts_trn foreign key(transaction_id) references transactions(id));