mirror of
https://github.com/yrzam/findb.git
synced 2024-12-29 10:32:00 +00:00
fixes
This commit is contained in:
parent
b723f5c1cc
commit
261d4a7b1e
18
schema.sql
18
schema.sql
@ -86,12 +86,12 @@ CREATE TABLE "fin_storages" (
|
|||||||
CREATE TABLE "fin_transaction_categories" (
|
CREATE TABLE "fin_transaction_categories" (
|
||||||
"id" INTEGER NOT NULL,
|
"id" INTEGER NOT NULL,
|
||||||
"name" TEXT NOT NULL UNIQUE,
|
"name" TEXT NOT NULL UNIQUE,
|
||||||
"is_passive" INTEGER CHECK(is_passive is null or is_initial_import is null),
|
"is_passive" INTEGER CHECK(not (is_passive and is_initial_import)),
|
||||||
"is_initial_import" INTEGER CHECK(is_passive is null or is_initial_import is null),
|
"is_initial_import" INTEGER CHECK(not (is_passive and is_initial_import)),
|
||||||
"parent_id" INTEGER,
|
"parent_id" INTEGER,
|
||||||
"min_view_depth" INTEGER NOT NULL DEFAULT 0,
|
"min_view_depth" INTEGER NOT NULL DEFAULT 0,
|
||||||
PRIMARY KEY("id"),
|
FOREIGN KEY("parent_id") REFERENCES "fin_transaction_categories"("id"),
|
||||||
FOREIGN KEY("parent_id") REFERENCES "fin_transaction_categories"("id")
|
PRIMARY KEY("id")
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE "fin_transaction_plans" (
|
CREATE TABLE "fin_transaction_plans" (
|
||||||
@ -273,7 +273,7 @@ select
|
|||||||
c.parent_id=new.id and
|
c.parent_id=new.id and
|
||||||
(
|
(
|
||||||
not(new.is_passive is null or new.is_passive is c.is_passive) or
|
not(new.is_passive is null or new.is_passive is c.is_passive) or
|
||||||
not(new.is_initial_import is null or new.is_initial_import=c.is_initial_import)
|
not(new.is_initial_import is null or new.is_initial_import is c.is_initial_import)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
then raise(abort, 'child conditions not met')
|
then raise(abort, 'child conditions not met')
|
||||||
@ -322,14 +322,14 @@ select
|
|||||||
c.parent_id=new.id and
|
c.parent_id=new.id and
|
||||||
(
|
(
|
||||||
not(new.is_passive is null or new.is_passive is c.is_passive) or
|
not(new.is_passive is null or new.is_passive is c.is_passive) or
|
||||||
not(new.is_initial_import is null or new.is_initial_import=c.is_initial_import)
|
not(new.is_initial_import is null or new.is_initial_import is c.is_initial_import)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
then raise(abort, 'child conditions not met')
|
then raise(abort, 'child conditions not met')
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
CREATE VIEW "current_balance_goals" AS select
|
CREATE VIEW current_balance_goals AS select
|
||||||
t.amount_left=0 as is_accomplished,
|
t.amount_left=0 as is_accomplished,
|
||||||
t.goal,
|
t.goal,
|
||||||
t.storage,
|
t.storage,
|
||||||
@ -381,7 +381,7 @@ order by
|
|||||||
is_accomplished asc,
|
is_accomplished asc,
|
||||||
t.priority desc;
|
t.priority desc;
|
||||||
|
|
||||||
CREATE VIEW "current_balances" AS select
|
CREATE VIEW current_balances AS select
|
||||||
*
|
*
|
||||||
from (
|
from (
|
||||||
select
|
select
|
||||||
@ -480,7 +480,7 @@ order by
|
|||||||
sort1 desc,
|
sort1 desc,
|
||||||
priority desc;
|
priority desc;
|
||||||
|
|
||||||
CREATE VIEW "current_fin_asset_rates" as
|
CREATE VIEW current_fin_asset_rates as
|
||||||
select
|
select
|
||||||
fa.id as pseudo_id,
|
fa.id as pseudo_id,
|
||||||
fat.name as asset_type,
|
fat.name as asset_type,
|
||||||
|
Loading…
Reference in New Issue
Block a user