048
This commit is contained in:
parent
95386bb49a
commit
412578f294
3 changed files with 22 additions and 1 deletions
BIN
src/db/db_up
BIN
src/db/db_up
Binary file not shown.
|
@ -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
20
src/db/reviews.nim
Normal 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)
|
||||
);
|
||||
""")
|
Loading…
Reference in a new issue