-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e06f94c
commit 58edf55
Showing
4 changed files
with
5 additions
and
5 deletions.
There are no files selected for viewing
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
...9-143242_create_item_weights_table/up.sql → ..._create_item_real_quantities_table/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
-- SQL defining the item_weights table. | ||
-- SQL defining the item_real_quantities table. | ||
-- Each item, being a physical object, has a weight. This table defines the weights of items. | ||
-- The weight of an item may change over time, and be measured using different scales and by | ||
-- different people. | ||
CREATE TABLE item_weights ( | ||
CREATE TABLE item_real_quantities ( | ||
id SERIAL PRIMARY KEY, | ||
item_id INTEGER REFERENCES items(id), | ||
weight DECIMAL(10, 2) NOT NULL, | ||
weight_unit_id INTEGER REFERENCES weight_units(id), | ||
unit_id INTEGER REFERENCES units(id), | ||
sensor_id INTEGER REFERENCES items(id), | ||
measured_at TIMESTAMPTZ NOT NULL DEFAULT now(), | ||
measured_by INTEGER REFERENCES users(id), | ||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(), | ||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(), | ||
created_by INTEGER NOT NULL REFERENCES users(id), | ||
updated_by INTEGER NOT NULL REFERENCES users(id), | ||
FOREIGN KEY (item_id, weight_unit_id) REFERENCES items(item_id, weight_unit_id), | ||
FOREIGN KEY (item_id, unit_id) REFERENCES items(item_id, unit_id), | ||
); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters