Skip to content

Commit

Permalink
Merge pull request #9 from ubccsss/daniel/pg-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickhySh authored Jan 27, 2024
2 parents 0d05947 + b0da627 commit fe618e8
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion database/init/0_init_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CREATE TABLE item_individual (
reservable BOOL NOT NULL,
quantity_remaining INT NOT NULL CONSTRAINT nonneg_quantity CHECK (quantity_remaining >= 0),
low_stock_threshold INT NOT NULL CONSTRAINT nonneg_threshold CHECK (low_stock_threshold >= 0),
last_restocked TIMESTAMP, -- maybe non null to allow for initial setup?
last_restocked DATE, -- maybe non null to allow for initial setup?
max_quantity_per_transaction INT NOT NULL CONSTRAINT positive_max CHECK (max_quantity_per_transaction > 0)
);

Expand Down
2 changes: 1 addition & 1 deletion database/init_test/0_init_test_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ CREATE TABLE item_individual (
reservable BOOL NOT NULL,
quantity_remaining INT NOT NULL CONSTRAINT nonneg_quantity CHECK (quantity_remaining >= 0),
low_stock_threshold INT NOT NULL CONSTRAINT nonneg_threshold CHECK (low_stock_threshold >= 0),
last_restocked TIMESTAMP, -- maybe non null to allow for initial setup?
last_restocked DATE, -- maybe non null to allow for initial setup?
max_quantity_per_transaction INT NOT NULL CONSTRAINT positive_max CHECK (max_quantity_per_transaction > 0)
);

Expand Down
20 changes: 10 additions & 10 deletions database/init_test/1_add_test_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ VALUES
FALSE,
12,
5,
CURRENT_TIMESTAMP,
'2023-12-20',
3
),
(
Expand All @@ -55,7 +55,7 @@ VALUES
FALSE,
6,
2,
CURRENT_TIMESTAMP,
'2023-12-24',
1
);

Expand Down Expand Up @@ -90,10 +90,10 @@ WHERE
name = 'Coca-Cola';

INSERT INTO
transaction (total, payer_email)
transaction (total, transaction_time, payer_email)
VALUES
(4.00, '[email protected]'),
(2.00, '[email protected]');
(4.00, '2024-01-10 14:00:36 -8:00', '[email protected]'),
(2.00, '2024-01-21 10:21:11 -8:00', '[email protected]');

INSERT INTO
transaction_item (transaction_id, item_id, item_quantity)
Expand Down Expand Up @@ -171,9 +171,9 @@ INSERT INTO
user_id
)
SELECT
'url',
'url1',
5.00,
CURRENT_TIMESTAMP,
'2024-01-02 04:05:06 -8:00',
user_id
FROM
csss_user
Expand All @@ -188,9 +188,9 @@ INSERT INTO
user_id
)
SELECT
'url',
'url2',
20.00,
CURRENT_TIMESTAMP,
'2024-01-08 15:20:00 -8:00',
user_id
FROM
csss_user
Expand All @@ -204,6 +204,6 @@ INSERT INTO
item_quantity
)
VALUES
(1, 1, 1),
(1, 1, 2),
(2, 2, 1),
(2, 3, 1);
Binary file added design/database/database_schema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added design/database/queryables.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added design/database/test_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed design/database_schema.png
Binary file not shown.

0 comments on commit fe618e8

Please sign in to comment.