1 -- Copyright © 2021 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.
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.
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/>.
16 -- profiles ground for Room
18 PRAGMA foreign_keys = OFF;
21 create table profiles(
25 use_authentication integer not null,
28 order_no integer not null,
29 permit_posting integer not null default 0,
30 theme integer not null default -1,
31 preferred_accounts_filter varchar,
32 future_dates integer not null,
33 api_version integer not null,
34 show_commodity_by_default integer not null default 0,
35 default_commodity text,
36 show_comments_by_default integer not null default 1,
37 detected_version_pre_1_19 integer not null,
38 detected_version_major integer not null,
39 detected_version_minor integer not null,
42 insert into profiles_new(
43 uuid, name, url, use_authentication, auth_user, auth_password, order_no,
44 permit_posting, theme, preferred_accounts_filter, future_dates, api_version,
45 show_commodity_by_default, default_commodity, show_comments_by_default,
46 detected_version_pre_1_19, detected_version_major, detected_version_minor)
47 select uuid, name, url, use_authentication, auth_user, auth_password, order_no,
48 permit_posting, theme, preferred_accounts_filter, future_dates, api_version,
49 show_commodity_by_default, default_commodity, show_comments_by_default,
50 detected_version_pre_1_19, detected_version_major, detected_version_minor
55 alter table profiles_new
58 create table options_new(profile varchar not null, name varchar not null, value varchar, primary key(profile, name));
60 insert into options_new(profile, name, value)
61 select profile, name, value from options;
65 alter table options_new
68 create table account_values_new(
69 profile varchar not null,
70 account varchar not null,
71 currency varchar not null default '',
73 generation integer not null default 0,
74 primary key(profile, account, currency));
76 insert into account_values_new(
77 profile, account, currency, value, generation)
78 select profile, account, currency, value, generation
81 drop table account_values;
82 alter table account_values_new rename to account_values;
87 PRAGMA foreign_keys = ON;