Skip to content

Commit

Permalink
fix(journal): use a FK on account_id
Browse files Browse the repository at this point in the history
This commit fixes the journal and general ledger by requiring a foreign
key on account.  Invalid account_id can not longer be submitted,
rendering the journal in a broken UI state for tables that do JOINs on
accounts.
  • Loading branch information
Jonathan Niles authored and sfount committed Dec 3, 2016
1 parent faab8d7 commit bc8e7de
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/models/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,7 @@ CREATE TABLE `general_ledger` (
FOREIGN KEY (`period_id`) REFERENCES `period` (`id`),
FOREIGN KEY (`project_id`) REFERENCES `project` (`id`) ON UPDATE CASCADE,
FOREIGN KEY (`currency_id`) REFERENCES `currency` (`id`) ON UPDATE CASCADE,
FOREIGN KEY (`account_id`) REFERENCES `account` (`id`),
FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON UPDATE CASCADE,
FOREIGN KEY (`cc_id`) REFERENCES `cost_center` (`id`) ON UPDATE CASCADE,
FOREIGN KEY (`pc_id`) REFERENCES `profit_center` (`id`) ON UPDATE CASCADE
Expand Down Expand Up @@ -1318,6 +1319,7 @@ CREATE TABLE `posting_journal` (
FOREIGN KEY (`fiscal_year_id`) REFERENCES `fiscal_year` (`id`),
FOREIGN KEY (`period_id`) REFERENCES `period` (`id`),
FOREIGN KEY (`project_id`) REFERENCES `project` (`id`) ON UPDATE CASCADE,
FOREIGN KEY (`account_id`) REFERENCES `account` (`id`),
FOREIGN KEY (`currency_id`) REFERENCES `currency` (`id`) ON UPDATE CASCADE,
FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON UPDATE CASCADE,
FOREIGN KEY (`cc_id`) REFERENCES `cost_center` (`id`) ON UPDATE CASCADE,
Expand Down

0 comments on commit bc8e7de

Please sign in to comment.