text: CREATE TABLE Users (
      id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
      email VARCHAR UNIQUE NOT NULL,
      password VARCHAR(255) NOT NULL,
      firstname VARCHAR(255) NOT NULL,
      lastname VARCHAR(255) NOT NULL,
      addr VARCHAR(255) NOT NULL,
      balance FLOAT NOT NULL
  );
  
  CREATE TABLE Sellers (
      id INT NOT NULL PRIMARY KEY REFERENCES Users(id)
  );
  
  CREATE TABLE Product_Categories (
      name VARCHAR(255) NOT NULL PRIMARY KEY
  );
  
  CREATE TABLE Products (
      id INT NOT NULL PRIMARY KEY,
      name VARCHAR(255) NOT NULL, -- this cannot be unique? how else do we track if two sellers are selling same item?
      category VARCHAR(255) NOT NULL REFERENCES Product_Categories (name),
      --price FLOAT NOT NULL,
      available BOOLEAN DEFAULT TRUE, -- What is the purpose for this when we have inventory?
      description_link VARCHAR(255) NOT NULL -- need to implement accessing a link, 
      -- seller_id INT NOT NULL REFERENCES Sellers(id)  -- possibly change this data type
  );
  CREATE TABLE Inventory (
      product_id INTEGER NOT NULL REFERENCES Products(id),
      seller_id INTEGER NOT NULL REFERENCES Sellers(id),
      price FLOAT NOT NULL,
      quantity INTEGER NOT NULL check (quantity >= 0),
      PRIMARY KEY(product_id, seller_id)
  );
  CREATE TABLE Cart (
      id INT NOT NULL REFERENCES Users(id),
      pid INT NOT NULL REFERENCES Products(id),
      seller_id INT REFERENCES Sellers(id),
      FOREIGN KEY(pid, seller_id) REFERENCES Inventory(product_id, seller_id),
      PRIMARY KEY(id, pid, seller_id),
      quantity INT NOT NULL
  ); -- still need to create trigger --
  
  CREATE TABLE Saved_Cart (
      id INT NOT NULL REFERENCES Users(id),
      pid INT NOT NULL REFERENCES Products(id),
      seller_id INT REFERENCES Sellers(id),
      FOREIGN KEY(pid, seller_id) REFERENCES Inventory(product_id, seller_id),
      PRIMARY KEY(id, pid, seller_id),
      quantity INT NOT NULL
  );
  
  CREATE TABLE Orders (
      id INT NOT NULL PRIMARY KEY,
      uid INT NOT NULL REFERENCES Users(id),
      time_purchased timestamp without time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE 'UTC')
  );
  
  CREATE TABLE Items_ordered (
      order_id INT NOT NULL REFERENCES Orders(id),
      product_id INT NOT NULL REFERENCES Products(id),
      seller_id INT NOT NULL REFERENCES Sellers(id),
      FOREIGN KEY(product_id, seller_id) REFERENCES Inventory(product_id, seller_id),
      price FLOAT NOT NULL,
      quantity INT NOT NULL,
      --status BOOLEAN DEFAULT FALSE,
      status INT DEFAULT 0 CHECK(status IN (0, 1)),
      fulfillment_time timestamp without time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE 'UTC'),
      PRIMARY KEY(order_id, product_id, seller_id)
  );
  
  
  CREATE TABLE Seller_ratings(
      seller_id INT NOT NULL REFERENCES Users(id),
      buyer_id INT NOT NULL REFERENCES Users(id),
      rating INT CHECK (rating >=0 and rating <=5 ), -- define range --
      review TEXT,
      polarity INT NOT NULL,
      review_time timestamp without time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE 'UTC'),
      PRIMARY KEY (seller_id,buyer_id)
      );
  
  CREATE TABLE Product_ratings (
      product_id INT NOT NULL REFERENCES Products(id),
      buyer_id INT NOT NULL REFERENCES Users(id),
      rating INT CHECK (rating >=0 and rating <=5 ) , -- define range --
      review TEXT,
      polarity INT NOT NULL,
      review_time timestamp without time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE 'UTC'),
      PRIMARY KEY (product_id, buyer_id)
      );
  
  
  
  
  