database: Use STORED instead of VIRTUAL in credit table

This commit is contained in:
2023-12-23 21:29:22 +01:00
parent 4ee780183e
commit ed0dba605b

View File

@ -158,8 +158,8 @@ CREATE TABLE credit (
net_amount INTEGER NOT NULL,
prev_net_amount INTEGER,
vat REAL NOT NULL,
vat_amount INTEGER NOT NULL GENERATED ALWAYS AS (ROUND((net_amount - COALESCE(prev_net_amount, 0)) * vat)) VIRTUAL,
gross_amount INTEGER NOT NULL GENERATED ALWAYS AS (net_amount - COALESCE(prev_net_amount, 0) + vat_amount) VIRTUAL,
vat_amount INTEGER NOT NULL GENERATED ALWAYS AS (ROUND((net_amount - COALESCE(prev_net_amount, 0)) * vat)) STORED,
gross_amount INTEGER NOT NULL GENERATED ALWAYS AS (net_amount - COALESCE(prev_net_amount, 0) + vat_amount) STORED,
modifiers INTEGER,
prev_modifiers INTEGER,
amount INTEGER NOT NULL GENERATED ALWAYS AS (gross_amount + COALESCE(modifiers, 0) - COALESCE(prev_modifiers, 0)) STORED,