No, not a foreign key, just a regular value ```sql CREATE TABLE IF NOT EXISTS carts ( id INTEG

No, not a foreign key, just a regular value
CREATE TABLE IF NOT EXISTS carts (
id INTEGER PRIMARY KEY,

cartId INTEGER NOT NULL,
branchId INTEGER NOT NULL,
name TEXT NOT NULL,
productId INTEGER NOT NULL,
price REAL NOT NULL, -- << HERE
size TEXT NOT NULL,
quantity TEXT NOT NULL,
customerNotes TEXT NOT NULL DEFAULT '',
discount REAL,
discountName TEXT,
discountDescription TEXT DEFAULT '',
discountEndDate REAL,

createdBy INTEGER NOT NULL,
createdAt REAL NOT NULL,
updatedBy INTEGER,
updatedAt REAL,
status INTEGER NOT NULL,
FOREIGN KEY (branchId) REFERENCES branches(id),
FOREIGN KEY (cartId) REFERENCES cartIds(id),
FOREIGN KEY (productId) REFERENCES products(id),
FOREIGN KEY (createdBy) REFERENCES users (id),
FOREIGN KEY (updatedBy) REFERENCES users (id)
);
CREATE TABLE IF NOT EXISTS carts (
id INTEGER PRIMARY KEY,

cartId INTEGER NOT NULL,
branchId INTEGER NOT NULL,
name TEXT NOT NULL,
productId INTEGER NOT NULL,
price REAL NOT NULL, -- << HERE
size TEXT NOT NULL,
quantity TEXT NOT NULL,
customerNotes TEXT NOT NULL DEFAULT '',
discount REAL,
discountName TEXT,
discountDescription TEXT DEFAULT '',
discountEndDate REAL,

createdBy INTEGER NOT NULL,
createdAt REAL NOT NULL,
updatedBy INTEGER,
updatedAt REAL,
status INTEGER NOT NULL,
FOREIGN KEY (branchId) REFERENCES branches(id),
FOREIGN KEY (cartId) REFERENCES cartIds(id),
FOREIGN KEY (productId) REFERENCES products(id),
FOREIGN KEY (createdBy) REFERENCES users (id),
FOREIGN KEY (updatedBy) REFERENCES users (id)
);
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?