Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TZUP-124: Add budgets table for facility budget file upload #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
9.0.0 / 2020-09-16
==================
New functionality:
* [TZUP-124](https://openlmis.atlassian.net/browse/TZUP-124): Added budget, source of funds and budget line items migration script tables for facility budget file upload

8.3.1 / WIP
==================

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- WHEN COMMITTING OR REVIEWING THIS FILE: Make sure that the timestamp in the file name (that serves as a version) is the latest timestamp, and that no new migration have been added in the meanwhile.
-- Adding migrations out of order may cause this migration to never execute or behave in an unexpected way.
-- Migrations should NOT BE EDITED. Add a new migration to apply changes.

CREATE TABLE budgets (
id uuid NOT NULL,
facilityid uuid NOT NULL,
sourceapplication character varying(50) NOT NULL UNIQUE,
createdby uuid NOT NULL,
createddate timestamp with time zone NOT NULL DEFAULT 'now()',
modifiedby uuid NOT NULL,
modifieddate timestamp with time zone NOT NULL DEFAULT 'NOW()',
CONSTRAINT budgets_pk PRIMARY KEY (id)
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- WHEN COMMITTING OR REVIEWING THIS FILE: Make sure that the timestamp in the file name (that serves as a version) is the latest timestamp, and that no new migration have been added in the meanwhile.
-- Adding migrations out of order may cause this migration to never execute or behave in an unexpected way.
-- Migrations should NOT BE EDITED. Add a new migration to apply changes.

CREATE TABLE source_of_funds (
id uuid NOT NULL,
code character varying(200) NOT NULL UNIQUE,
name character varying(200) NOT NULL UNIQUE,
createdDate timestamp with time zone NOT NULL DEFAULT 'NOW()',
modifiedDate timestamp with time zone NOT NULL DEFAULT 'NOW()',
displayOrder uuid NOT NULL,
CONSTRAINT source_of_funds_pk PRIMARY KEY (id)
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- WHEN COMMITTING OR REVIEWING THIS FILE: Make sure that the timestamp in the file name (that serves as a version) is the latest timestamp, and that no new migration have been added in the meanwhile.
-- Adding migrations out of order may cause this migration to never execute or behave in an unexpected way.
-- Migrations should NOT BE EDITED. Add a new migration to apply changes.


CREATE TABLE budget_line_items (
id uuid NOT NULL,
budgetid uuid NOT NULL,
fundsourceid uuid NOT NULL,
allocatedbudget numeric NOT NULL,
additive BOOLEAN NOT NULL DEFAULT 'true',
creditvalue character varying(100) NOT NULL,
notes character varying(255) NOT NULL,
createdby uuid NOT NULL,
createddate timestamp with time zone NOT NULL DEFAULT 'NOW()',
modifiedby uuid NOT NULL,
modifieddate timestamp with time zone NOT NULL DEFAULT 'NOW()',
CONSTRAINT budget_line_items_pk PRIMARY KEY (id)
);

ALTER TABLE budget_line_items ADD CONSTRAINT fk_budget_line_items_budget_id FOREIGN KEY (budgetid) REFERENCES budgets(id);
ALTER TABLE budget_line_items ADD CONSTRAINT fk_budget_line_items_fund_source_id FOREIGN KEY (fundsourceid) REFERENCES source_of_funds(id);