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 -- migrate from revision 58 to revision 59
18 CREATE TABLE profiles_new (
19 id INTEGER NOT NULL PRIMARY KEY,
23 use_authentication INTEGER NOT NULL,
26 order_no INTEGER NOT NULL,
27 permit_posting INTEGER NOT NULL,
28 theme INTEGER NOT NULL DEFAULT -1,
29 preferred_accounts_filter TEXT,
30 future_dates INTEGER NOT NULL,
31 api_version INTEGER NOT NULL,
32 show_commodity_by_default INTEGER NOT NULL,
33 default_commodity TEXT,
34 show_comments_by_default INTEGER NOT NULL DEFAULT 1,
35 detected_version_pre_1_19 INTEGER NOT NULL,
36 detected_version_major INTEGER NOT NULL,
37 detected_version_minor INTEGER NOT NULL);
39 insert into profiles_new(
40 uuid, name, url, use_authentication, auth_user, auth_password,
41 order_no, permit_posting, theme, preferred_accounts_filter, future_dates, api_version,
42 show_commodity_by_default, default_commodity, show_comments_by_default, detected_version_pre_1_19,
43 detected_version_major, detected_version_minor)
44 select uuid, name, url, use_authentication, auth_user, auth_password,
45 order_no, permit_posting, theme, preferred_accounts_filter, future_dates, api_version,
46 show_commodity_by_default, default_commodity, show_comments_by_default, detected_version_pre_1_19,
47 detected_version_major, detected_version_minor
50 create table accounts_new(
51 id integer primary key not null,
52 profile_id integer not null references profiles_new(id) on delete cascade on update restrict,
53 level INTEGER NOT NULL,
55 name_upper TEXT NOT NULL,
57 expanded INTEGER NOT NULL DEFAULT 1,
58 amounts_expanded INTEGER NOT NULL DEFAULT 0,
59 generation INTEGER NOT NULL DEFAULT 0);
61 insert into accounts_new(profile_id, level, name, name_upper, parent_name, expanded, amounts_expanded, generation)
62 select p.id, a.level, a.name, a.name_upper, a.parent_name, a.expanded, a.amounts_expanded, a.generation
64 join accounts a on a.profile=p.uuid;
67 alter table accounts_new rename to accounts;
70 alter table profiles_new rename to profiles;