Add quantity constraint

This commit is contained in:
ekzyis 2023-11-26 18:31:22 +01:00
parent e67332fd1b
commit 0daddb8e5d
1 changed files with 1 additions and 0 deletions

View File

@ -50,6 +50,7 @@ CREATE TABLE orders(
invoice_id UUID NOT NULL REFERENCES invoices(id) invoice_id UUID NOT NULL REFERENCES invoices(id)
); );
ALTER TABLE orders ADD CONSTRAINT order_price CHECK(price > 0 AND price < 100); ALTER TABLE orders ADD CONSTRAINT order_price CHECK(price > 0 AND price < 100);
ALTER TABLE orders ADD CONSTRAINT order_quantity CHECK(quantity > 0);
CREATE TABLE matches( CREATE TABLE matches(
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
oid1 UUID NOT NULL REFERENCES orders(id), oid1 UUID NOT NULL REFERENCES orders(id),