X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fres%2Fraw%2Fsql_54.sql;h=f8e13ba9885127dc9f28b2330cec2a2f5904f36d;hb=390a653a4424bd146f73bca3e421a0be252ee443;hp=1d6565f442c2a256ccf5d1a4532bc7b3247f0c2b;hpb=3ab99e1679326277d6ba7f8ce28f17a96dfa07aa;p=mobile-ledger.git diff --git a/app/src/main/res/raw/sql_54.sql b/app/src/main/res/raw/sql_54.sql index 1d6565f4..f8e13ba9 100644 --- a/app/src/main/res/raw/sql_54.sql +++ b/app/src/main/res/raw/sql_54.sql @@ -1,4 +1,4 @@ --- Copyright © 2020 Damyan Ivanov. +-- 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 @@ -13,4 +13,17 @@ -- You should have received a copy of the GNU General Public License -- along with MoLe. If not, see . --- this is handled in a Room migration \ No newline at end of file +-- copied from the Room migration + +BEGIN TRANSACTION; + +CREATE TABLE templates (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name TEXT NOT NULL, regular_expression TEXT NOT NULL, test_text TEXT, transaction_description TEXT, transaction_description_match_group INTEGER, transaction_comment TEXT, transaction_comment_match_group INTEGER, date_year INTEGER, date_year_match_group INTEGER, date_month INTEGER, date_month_match_group INTEGER, date_day INTEGER, date_day_match_group INTEGER); +CREATE TABLE template_accounts (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, template_id INTEGER NOT NULL, acc TEXT, position INTEGER NOT NULL, acc_match_group INTEGER, currency INTEGER, currency_match_group INTEGER, amount REAL, amount_match_group INTEGER, comment TEXT, comment_match_group INTEGER, negate_amount INTEGER, FOREIGN KEY(template_id) REFERENCES templates(id) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(currency) REFERENCES currencies(id) ON UPDATE NO ACTION ON DELETE NO ACTION); +insert into templates(id, name, regular_expression, test_text, transaction_description, transaction_description_match_group, transaction_comment, transaction_comment_match_group, date_year, date_year_match_group, date_month, date_month_match_group, date_day, date_day_match_group) select id, name, regular_expression, test_text, transaction_description, transaction_description_match_group, transaction_comment, transaction_comment_match_group, date_year, date_year_match_group, date_month, date_month_match_group, date_day, date_day_match_group from patterns; +insert into template_accounts(id, template_id, acc, position, acc_match_group, currency, currency_match_group, amount, amount_match_group, amount, amount_match_group, comment, comment_match_group, negate_amount) select id, pattern_id, acc, position, acc_match_group, currency, currency_match_group, amount, amount_match_group, amount, amount_match_group, comment, comment_match_group, negate_amount from pattern_accounts; +create index fk_template_accounts_template on template_accounts(template_id); +create index fk_template_accounts_currency on template_accounts(currency); +drop table pattern_accounts; +drop table patterns; + +COMMIT TRANSACTION; \ No newline at end of file