Schema - juniprs/gat-mcprath GitHub Wiki
users
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
email |
string | not null, indexed, unique |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on email, unique: true
- index on session_token
- has_one :cart
carts
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, unique, foreign key (users) |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on user_id, unique: true
- belongs_to :user
- has_many :cart_items
cart_items
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
cart_id |
integer | not null, indexed, foreign key (carts) |
product_id |
integer | not null, indexed, foreign key (products) |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on cart_id
- belongs_to :cart
products
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
description |
text | not null |
price |
integer | not null |
category_id |
integer | not null, foreign key (category) |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- belongs_to :cart
- has_one_attached :photo