-
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.
Merge branch 'main' of github.com:earth-metabolome-initiative/emi-mon…
…orepo
- Loading branch information
Showing
16 changed files
with
107 additions
and
39 deletions.
There are no files selected for viewing
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
15 changes: 0 additions & 15 deletions
15
web/backend/migrations/2024-02-06-144814_create_laboratories_table/up.sql
This file was deleted.
Oops, something went wrong.
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
17 changes: 0 additions & 17 deletions
17
web/backend/migrations/2024-02-06-145327_create_laboratory_users_table/up.sql
This file was deleted.
Oops, something went wrong.
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
web/backend/migrations/2024-02-08-085202_create_organization_locations_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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- SQL defining the organizations locations table. | ||
-- An organization may be present in one or more locations. | ||
-- An organization may change locations over time. | ||
CREATE TABLE organization_locations ( | ||
id SERIAL PRIMARY KEY, | ||
organization_id INTEGER REFERENCES organizations(id), | ||
location_id INTEGER REFERENCES locations(id), | ||
previous_location_id INTEGER REFERENCES organization_locations(id), | ||
state INTEGER NOT NULL, | ||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
created_by INTEGER REFERENCES users(id), | ||
updated_by INTEGER REFERENCES users(id) | ||
); |
1 change: 0 additions & 1 deletion
1
...144814_create_laboratories_table/down.sql → ...e_container_vertical_rules_table/down.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,2 +1 @@ | ||
-- This file should undo anything in `up.sql` | ||
DROP TABLE laboratories; |
20 changes: 20 additions & 0 deletions
20
web/backend/migrations/2024-02-08-090153_create_container_vertical_rules_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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- SQL defining the container_vertical_rules table. | ||
-- The container rules define whether an item type can contain another item type. | ||
-- For instance a rack can contain tubes, but a tube cannot contain a rack. | ||
-- We define such rules in an allow-list fashion, meaning that if a rule is not defined, | ||
-- then the item type cannot contain another item type. The rules are defined by an admin | ||
-- user, and are used to enforce the containment rules when creating or updating items. | ||
-- Some containers may only contain items that are within a certain temperature, humidity, | ||
-- or pressure range. These constraints are also defined in the container rules. | ||
CREATE TABLE container_vertical_rules ( | ||
id SERIAL PRIMARY KEY, | ||
container_item_type_id INTEGER REFERENCES item_types(id), | ||
contained_item_type_id INTEGER REFERENCES item_types(id), | ||
temperature INTERVAL DEFAULT NULL, | ||
humidity INTERVAL DEFAULT NULL, | ||
pressure INTERVAL DEFAULT NULL, | ||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
created_by INTEGER REFERENCES users(id), | ||
updated_by INTEGER REFERENCES users(id) | ||
); |
1 change: 1 addition & 0 deletions
1
web/backend/migrations/2024-02-08-090409_create_item_types_table/down.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
-- This file should undo anything in `up.sql` |
15 changes: 15 additions & 0 deletions
15
web/backend/migrations/2024-02-08-090409_create_item_types_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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-- SQL defining the item_types table. | ||
-- An item type is a type of item that can be tracked and managed, may have a cost, | ||
-- and may be rented. As such it as two different columns one for the cost, its currency, | ||
-- and a cost per day for renting and the current of the renting cost. An item may have | ||
-- an expiration date and may be associated with one or more projects (which is tracked | ||
-- in the item_projects table). | ||
CREATE TABLE item_types ( | ||
id SERIAL PRIMARY KEY, | ||
name VARCHAR(255) NOT NULL UNIQUE, | ||
description TEXT, | ||
created_by INTEGER REFERENCES users(id), | ||
updated_by INTEGER REFERENCES users(id), | ||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | ||
); |
1 change: 1 addition & 0 deletions
1
web/backend/migrations/2024-02-08-091232_create_container_horizontal_rules_table/down.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
-- This file should undo anything in `up.sql` |
21 changes: 21 additions & 0 deletions
21
web/backend/migrations/2024-02-08-091232_create_container_horizontal_rules_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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- SQL defining the container_horizontal_rules table. | ||
-- The container horizontal rules define whether an item type can be placed next to another item type. | ||
-- For instance a acid product cannot be placed next to a base product. Generally speaking, most items | ||
-- can be placed next to each other, but some items cannot be placed next to each other. These rules | ||
-- are defined in the form of a deny-list, meaning that if a rule is not defined, then the item type | ||
-- can be placed next to any other item type. The rules are defined by an admin user, and are used to | ||
-- enforce the placement rules when creating or updating items. Some items may only be placed next to | ||
-- items that are within a certain temperature, humidity, or pressure range. These constraints are also | ||
-- defined in the container rules. | ||
CREATE TABLE container_horizontal_rules ( | ||
id SERIAL PRIMARY KEY, | ||
item_type_id INTEGER REFERENCES item_types(id), | ||
other_item_type_id INTEGER REFERENCES item_types(id), | ||
temperature INTERVAL DEFAULT NULL, | ||
humidity INTERVAL DEFAULT NULL, | ||
pressure INTERVAL DEFAULT NULL, | ||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
created_by INTEGER REFERENCES users(id), | ||
updated_by INTEGER REFERENCES users(id) | ||
); |
1 change: 1 addition & 0 deletions
1
web/backend/migrations/2024-02-08-100852_create_manifactured_item_types_table/down.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
-- This file should undo anything in `up.sql` |
17 changes: 17 additions & 0 deletions
17
web/backend/migrations/2024-02-08-100852_create_manifactured_item_types_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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- SQL defining the manufactured_item_types table. | ||
-- A manufactured type is an item type that can be manufactured, sold, and bought. As such it | ||
-- has a cost, its currency, and a cost per day for renting and the current of the renting | ||
-- cost. | ||
CREATE TABLE manufactured_item_types ( | ||
id SERIAL PRIMARY KEY, | ||
item_type_id INTEGER REFERENCES item_types(id), | ||
cost DECIMAL(10, 2) NOT NULL, | ||
cost_per_day DECIMAL(10, 2) NOT NULL, | ||
currency VARCHAR(3) NOT NULL, | ||
manifacturer_id INTEGER REFERENCES organizations(id), | ||
barcode VARCHAR(255) NOT NULL UNIQUE, | ||
created_by INTEGER REFERENCES users(id), | ||
updated_by INTEGER REFERENCES users(id), | ||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | ||
); |
2 changes: 2 additions & 0 deletions
2
web/backend/migrations/2024-02-08-101004_create_expirable_item_types_table/down.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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- This file should undo anything in `up.sql` | ||
DROP TABLE expirable_item_types; |
13 changes: 13 additions & 0 deletions
13
web/backend/migrations/2024-02-08-101004_create_expirable_item_types_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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- SQL defining the expirable_item_types table. | ||
-- Item types appearing in this table have an expiration date, meaning that | ||
-- they have an interval of time associated to them after which they are no longer | ||
-- valid. This table is used to enforce the expiration date of items of a certain type. | ||
CREATE TABLE expirable_item_types ( | ||
id SERIAL PRIMARY KEY, | ||
item_type_id INTEGER REFERENCES item_types(id), | ||
expiration_interval INTERVAL NOT NULL, | ||
created_by INTEGER REFERENCES users(id), | ||
updated_by INTEGER REFERENCES users(id), | ||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP | ||
); |