X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fres%2Fraw%2Fsql_58.sql;fp=app%2Fsrc%2Fmain%2Fres%2Fraw%2Fsql_58.sql;h=0000000000000000000000000000000000000000;hp=ad28d1a5ba010b6fd2fe005084b1088ed0c6fb55;hb=9ea5a330029c99e0eecf55aaa94d8689fa64fc92;hpb=d5218337e111a377a3661f0ae4a5049edc055705 diff --git a/app/src/main/res/raw/sql_58.sql b/app/src/main/res/raw/sql_58.sql deleted file mode 100644 index ad28d1a5..00000000 --- a/app/src/main/res/raw/sql_58.sql +++ /dev/null @@ -1,150 +0,0 @@ --- Copyright © 2021 Damyan Ivanov. --- This file is part of MoLe. --- MoLe is free software: you can distribute it and/or modify it --- under the term of the GNU General Public License as published by --- the Free Software Foundation, either version 3 of the License, or --- (at your opinion), any later version. --- --- MoLe is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License terms for details. --- --- You should have received a copy of the GNU General Public License --- along with MoLe. If not, see . - --- profiles ground for Room - -PRAGMA foreign_keys = OFF; -BEGIN TRANSACTION; - -create table profiles( - uuid text not null, - name text not null, - url text not null, - use_authentication integer not null, - auth_user text, - auth_password text, - order_no integer not null, - permit_posting integer not null default 0, - theme integer not null default -1, - preferred_accounts_filter varchar, - future_dates integer not null, - api_version integer not null, - show_commodity_by_default integer not null default 0, - default_commodity text, - show_comments_by_default integer not null default 1, - detected_version_pre_1_19 integer not null, - detected_version_major integer not null, - detected_version_minor integer not null, - primary key(uuid)); - -insert into profiles_new( - uuid, name, url, use_authentication, auth_user, auth_password, order_no, - permit_posting, theme, preferred_accounts_filter, future_dates, api_version, - show_commodity_by_default, default_commodity, show_comments_by_default, - detected_version_pre_1_19, detected_version_major, detected_version_minor) -select uuid, name, url, use_authentication, auth_user, auth_password, order_no, - permit_posting, theme, preferred_accounts_filter, future_dates, api_version, - show_commodity_by_default, default_commodity, show_comments_by_default, - detected_version_pre_1_19, detected_version_major, detected_version_minor -from profiles; - -drop table profiles; - -alter table profiles_new -rename to profiles; - -create table options_new(profile varchar not null, name varchar not null, value varchar, primary key(profile, name)); - -insert into options_new(profile, name, value) -select profile, name, value from options; - -drop table options; - -alter table options_new -rename to options; - -create table account_values_new( - profile varchar not null, - account varchar not null, - currency varchar not null default '', - value real not null, - generation integer not null default 0, - primary key(profile, account, currency)); - -insert into account_values_new( - profile, account, currency, value, generation) -select profile, account, currency, value, generation -from account_values; - -drop table account_values; -alter table account_values_new rename to account_values; - -create table description_history_new( - description varchar collate NOCASE not null primary key, - description_upper varchar not null, - generation integer not null default 0, - primary key(description)); - -insert into description_history_new(description, description_upper, generation) -select description, description_upper, generation from description_history; - -drop table description_history; -alter table description_history_new rename to description_history; - --- transactions - -create table transactions_new( - profile varchar not null, - id integer not null, - data_hash varchar not null, - year integer not null, - month integer not null, - day integer not null, - description varchar collate NOCASE not null, - comment varchar, - generation integer not null default 0, - primary key(profile,id)); - -insert into transactions_new(profile, id, data_hash, year, month, day, description, - comment, generation) -select profile, id, data_hash, year, month, day, description, - comment, generation -from transactions; - -drop table transactions; -alter table transactions_new rename to transactions; - -create unique index un_transactions_data_hash on transactions(profile,data_hash); -create index idx_transaction_description on transactions(description); - --- transaction_accounts - -create table transaction_accounts_new( - profile varchar not null, - transaction_id integer not null, - order_no integer not null, - account_name varchar not null, - currency varchar not null default '', - amount real not null, - comment varchar, - generation integer not null default 0, - primary key(profile, transaction_id, order_no), - foreign key (profile,account_name) references accounts(profile,name) - on delete cascade on update restrict, - foreign key(profile, transaction_id) references transactions(profile,id) - on delete cascade on update restrict); - -insert into transaction_accounts_new(profile, transaction_id, order_no, account_name, - currency, amount, comment, generation) -select profile, transaction_id, order_no, account_name, - currency, amount, comment, generation -from transaction_accounts; - -drop table transaction_accounts; -alter table transaction_accounts_new rename to transaction_accounts; - -COMMIT TRANSACTION; - -PRAGMA foreign_keys = ON; \ No newline at end of file