Skip to content

Database schema

Ilya Novikov edited this page Dec 3, 2021 · 6 revisions

oney_db


dbdiagram.io link

https://dbdiagram.io/d/61a9529c8c901501c0de476f

dbdiagram.io string

Table Users as U {
  id int [pk, increment]
  email varchar [not null, unique]
  password_encrypted varchar
  username varchar(50)
  created_at timestamp
  updated_at timestamp
}

Table Products as P {
  id int [pk, increment]
  userId int [ref: > Users.id]
  title varchar
  imageUrl varchar
  description text
  categoryId int [ref: > Categories.id]
  price decimal
  created_at timestamp
  updated_at timestamp
}

Table Categories {
  id int [pk, increment]
  name varchar
  created_at timestamp
  updated_at timestamp
}

Table Reviews {
  id int [pk, increment]
  userId int [ref: > Users.id]
  productId int [ref: > Products.id]
  content text
  rating int
  created_at timestamp
  updated_at timestamp
}

Table Cart {
  id int [pk, increment]
  userId int [ref: > Users.id]
  productId int [ref: > Products.id]
  quantity int
  created_at timestamp
  updated_at timestamp
}

Clone this wiki locally