This commit is contained in:
cereci5049 2024-08-18 01:19:47 +05:30
parent 95386bb49a
commit 412578f294
3 changed files with 22 additions and 1 deletions

Binary file not shown.

View file

@ -1,5 +1,5 @@
import
./[users, products, orders, orderitems, addresses, payments],
./[users, products, orders, orderitems, addresses, payments, reviews],
../lib/mics
var conn = newTurso()
@ -10,3 +10,4 @@ setupOrders(conn)
setupOrderItems(conn)
setupAddresses(conn)
setupPayments(conn)
setupReviews(conn)

20
src/db/reviews.nim Normal file
View file

@ -0,0 +1,20 @@
import
turso,
strformat,
json,
strutils,
../model/model
proc setupReviews*(conn: Turso) =
conn.execute("""
CREATE TABLE Reviews (
id INTEGER PRIMARY KEY AUTOINCREMENT,
productId INTEGER,
buyerId INTEGER,
rating INTEGER,
comment TEXT,
reviewDate DATE,
FOREIGN KEY (productId) REFERENCES Products(id),
FOREIGN KEY (buyerId) REFERENCES Users(id)
);
""")