You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
2.4 KiB
Plaintext
132 lines
2.4 KiB
Plaintext
// Use DBML to define your database structure
|
|
// Docs: https://dbml.dbdiagram.io/docs
|
|
|
|
// Table follows {
|
|
// following_user_id integer
|
|
// followed_user_id integer
|
|
// created_at timestamp
|
|
// }
|
|
|
|
Table users {
|
|
id uuid [primary key]
|
|
username varchar
|
|
role enum [note: 'admin, employee, customer']
|
|
created_at timestamp
|
|
}
|
|
|
|
Table orders {
|
|
id uuid [primary key]
|
|
fk_customer_id uuid
|
|
product_order varchar
|
|
order_date datetime
|
|
due_date datetime
|
|
status enum [note: 'waiting, approved, processing, waiting to ship, shipped']
|
|
rush bool
|
|
event bool
|
|
new_art bool
|
|
repeat bool
|
|
digitizing bool
|
|
purchased_garments bool
|
|
supplied_file bool
|
|
// code varchar
|
|
notes varchar
|
|
created_at timestamp
|
|
updated_at timestamp
|
|
deleted_at timestamp
|
|
}
|
|
|
|
Ref: orders.fk_customer_id > customers.id
|
|
|
|
Table order_types {
|
|
id uuid [primary key]
|
|
name varchar
|
|
value varchar [note: 'DTG, Embroidery, Screen Printing, Vinyl']
|
|
}
|
|
|
|
Table orders_order_types {
|
|
id uuid [primary key]
|
|
fk_order_id uuid
|
|
fk_order_type_id uuid
|
|
}
|
|
|
|
Ref: orders_order_types.fk_order_id > orders.id
|
|
Ref: orders_order_types.fk_order_type_id > order_types.id
|
|
|
|
Table order_products {
|
|
id uuid [pk]
|
|
fk_order_id uuid
|
|
sku varchar
|
|
product_name varchar
|
|
color varchar
|
|
}
|
|
|
|
Ref: order_products.fk_order_id > orders.id
|
|
|
|
Table product_sizes {
|
|
id uuid [pk]
|
|
fk_order_product_id uuid
|
|
size varchar
|
|
amount integer
|
|
}
|
|
|
|
Ref: product_sizes.fk_order_product_id > order_products.id
|
|
|
|
Table product_services {
|
|
id uuid [primary key]
|
|
index int
|
|
fk_order_product_id uuid
|
|
service varchar
|
|
file varchar
|
|
placement varchar
|
|
logo_name varchar
|
|
logo_width decimal
|
|
logo_height decimal
|
|
setup_amount integer
|
|
amount integer
|
|
amount_price decimal
|
|
}
|
|
|
|
Ref: product_services.fk_order_product_id > order_products.id
|
|
|
|
Table logos {
|
|
id uuid [primary key]
|
|
name varchar
|
|
width decimal
|
|
height decimal
|
|
}
|
|
|
|
Table customers {
|
|
id uuid [primary key]
|
|
fk_user_id uuid
|
|
company_name varchar
|
|
internal_name varchar [note: 'image group quadreal for example']
|
|
shipping_address varchar
|
|
billing_address varchar
|
|
created_at timestamp
|
|
updated_at timestamp
|
|
deleted_at timestamp
|
|
}
|
|
|
|
Ref: customers.fk_user_id > users.id
|
|
|
|
Table contacts {
|
|
id uuid [primary key]
|
|
fk_customer_id uuid
|
|
first_name varchar
|
|
last_name varchar
|
|
email varchar
|
|
phone varchar
|
|
notes varchar
|
|
}
|
|
|
|
Ref: contacts.fk_customer_id > customers.id
|
|
|
|
Table invoices {
|
|
id uuid [primary key]
|
|
fk_order_id uuid
|
|
}
|
|
|
|
Ref: invoices.fk_order_id > orders.id
|
|
|
|
|