actual/packages/loot-core/migrations/1608652596043_parent_field.sql

14 lines
260 B
MySQL
Raw Permalink Normal View History

2022-04-29 02:44:38 +00:00
BEGIN TRANSACTION;
ALTER TABLE transactions ADD COLUMN parent_id TEXT;
UPDATE transactions SET
parent_id = CASE
WHEN isChild THEN SUBSTR(id, 1, INSTR(id, '/') - 1)
ELSE NULL
END;
CREATE INDEX trans_parent_id ON transactions(parent_id);
COMMIT;