Warehouse
Key
warehouse_id    
bigserial
NN
external_id    
uuid
NN
Key
web_app_customer    
bigserial
NN
warehouse_dba    
varchar
warehouse_name_listed    
varchar
NN
warehouse_location    
varchar
NN
online_inventory_website    
text
online_inventory_username    
varchar
online_inventory_password    
varchar
qbs_warehouse_location_id    
varchar
address1    
varchar
NN
address2    
varchar
city    
varchar
NN
state    
varchar
Key
country    
integer(3)
NN
zipcode    
varchar
NN
billing_address1    
varchar
billing_address2    
varchar
billing_address_city    
varchar
billing_address_state    
varchar
Key
billing_address_country    
integer(3)
billing_address_zipcode    
varchar
Key
contact    
varchar
NN
allow_same_day_orders    
boolean
billable    
boolean
NN
timezone    
integer(2)
NN
repack_capabilities    
varchar
dry_ice    
varchar
pallet_charge_a    
integer
pallet_charge_b    
integer
lumping_fee    
integer
ctr_unloading_fee    
integer
damage_control    
boolean
own_pallet_with_product    
varchar
pallet_exchange    
boolean
rate_sheet    
varchar
warehouse_holidays    
varchar
Key
Country_country_name    
varchar(50)
NN
Key
Country_country_name    
varchar(50)
NN
Key
operation_days    
serial
NN
is_deleted    
boolean
List of warehouses and Cold Storages. Should have logic in that if a product has a cold storage linked to it, it can't be deleted.
Customers
Key
customer_id    
bigserial
NN
external_id    
uuid
NN
Key
web_app_customer    
bigserial
NN
customer_name    
varchar(41)
NN
customer_dba    
varchar(41)
customer_name_listed_as    
varchar(41)
used_to_be_called    
varchar(41)
used_to_be_called_date_change    
date
Key
user_id    
bigserial
NN
quickbooks_cust_id    
varchar
erp_custom_id    
varchar
Key
customer_type_id    
integer
NN
order_frequency    
integer
order_frequency_days    
integer
avg_order_day    
varchar
address1    
varchar(60)
address2    
varchar(60)
city    
varchar(57)
state    
varchar(50)
Key
country_id    
integer(3)
zipcode    
varchar(10)
billing_company_name    
varchar(60)
billing_address1    
varchar(60)
billing_address2    
varchar(60)
billing_city    
varchar(57)
billing_state    
varchar(50)
billing_country_id    
integer(3)
billing_zipcode    
varchar(8)
send_invoice_mail_id    
boolean
send_invoice_email_id    
boolean
send_order_confirm    
boolean
order_confirm_by_email    
boolean
order_confirm_by_sms    
boolean
order_confirm_by_wechat    
boolean
order_confirm_by_whatsapp    
boolean
order_confirm_buyer    
boolean
bill_by_dba    
boolean
vendor_number    
varchar(25)
credit_insured    
boolean
credit_limit    
integer(15)
Key
payment_terms    
integer(2)
Key
payment_type    
integer(2)
average_pay_time    
integer(3)
current_balance_owed    
integer(18)
sales_order_default    
integer(2)
order_shipping_vendor_default_id    
integer(2)
order_shipping_collect_default    
integer(2)
email_sending_category_id    
integer(3)
product_customer_usually_buys    
varchar
Key
Country_country_name    
varchar(50)
NN
Key
buyer_id    
bigserial
Key
delivery_address    
bigserial
Key
accounting_contact    
bigserial
is_deleted    
boolean
status    
varchar(50)
Key
Payment_terms_web_customer_id    
bigserial
NN
Key
Payment_type_web_app_customer_id    
bigserial
NN
Since ANY and ALL Sales data is listed under the Sales table, it is accessable via the Customer UUID and UUID of the Sale. Therefore, anything that is associated on a separate table will be JOINed together on the frontend. Routing seems hectic, but it makes sense database wise.
Order Details - COME BACK TO! NEED MORE WORK!
Key
order_id    
bigserial
NN
external_id    
uuid
NN
Key
web_app_customer    
bigserial
NN
Key
customer_id    
bigserial
NN
customer_billing_city    
uuid
NN
customer_billing_state    
integer
NN
customer_po_number    
varchar(25)
NN
salesman_entered_order    
integer
NN
Key
warehouse_id    
uuid
NN
Key
order_type_id    
serial
NN
order_rush    
boolean
order_number    
varchar
NN
order_sent_on    
timestamptz
NN
Key
trucker_id    
uuid
Key
ship_term    
integer
order_first_created_date    
timestamptz
NN
special_instructions_note    
varchar(300)
Key
inventory_product_id    
uuid
NN
is_voided    
boolean
Key
order_status_id    
serial
NN
created_at    
timestamptz
NN
last_modified    
timestamptz
NN
order_sent_in    
timestamptz
NN
order_confirmed_back    
timestamptz
shipping_bol    
varchar(50)
trucking_po    
bigserial
total_pallets    
numeric(10, 2)
NN
assumed_total_pallets    
numeric(10, 2)
NN
Key
user_id    
bigserial
NN
Key
last_modified_by    
bigserial
NN
This is the barebones table. It will utilize IDs to make it quick! ANYTHING that is listed in another table can be pulled up from just using the ID from another table and joining the details. Crazy! This means I don't add the following: customer billing city and state, This pertains to the specific details of this order. Order Items pertains to all the products apart of the order! **Since pulling the customer over by the UUID, do I really need to have the data of the following or can I just JOIN or grab it:? Billing City and Billing State ??? Why are there PKs that I can't delete??? Need to do more research on when to PK and Not. Also, need to do FKs, but need to know how to later!
Web_App_Customer
Key
web_app_customer_id    
bigserial
NN
external_id    
uuid
NN
company_name    
varchar(41)
NN
name    
varchar(255)
NN
email    
varchar(255)
NN
Key
language_id    
serial
NN
created_at    
timestamptz
NN
updated_at    
timestamptz
NN
last_active    
timestamptz
is_inactive    
boolean
inactive_since    
timestamptz
undeleteable    
boolean
payment_status    
varchar
NN
is_on_trial    
boolean
trial_start_date    
timestamptz
trial_end_date    
timestamptz
is_subscription_active    
boolean
Key
subscription_plan_id    
integer
billing_start_date    
timestamptz
NN
billing_end_date    
timestamptz
NN
is_deleted????    
boolean
disk_quota    
bigint
NN
is_anonymized    
boolean
NN
deleted_at    
timestamptz
This is the master list of the web app customers. Company IDs are assigned in here and those are the UUIDs. Allowsing SOFT DELETE for the system. Hard Deteting for select options. Most are SOFT DELETE via is_delete or is_voided
Order_Type
Key
order_type_id    
serial
NN
external_id    
uuid
NN
Key
web_app_customer    
bigserial
NN
order_type_name    
varchar(30)
description    
text
Roles
Key
role_id    
serial
NN
role_name    
varchar(30)
NN
role_permission    
integer
NN
You can name roles here. Need to figure out how it works
Customer_Type
Key
customer_type_id    
integer
NN
customer_type_name    
varchar
Key
sellable    
varchar
Think this will be a table, but not fully sure. Still processing and thinking things through. Same as Sellable table...
Sellable
Key
sellable_id    
integer
NN
sellable_type    
varchar(50)
More thought needs to go into this! Currently added, but more thought out is needed!
Payment_terms
Key
web_customer_id    
bigserial
NN
Key
payment_terms_id    
integer
NN
payment_days    
integer
NN
payment_name    
integer
NN
Need to think this one through more as well!!
Payment_type
Key
web_app_customer_id    
bigserial
NN
Key
payment_type_id    
integer
NN
payment_type_name    
varchar(50)
NN
Ship_terms
Key
ship_terms_id    
integer
NN
Key
web_app_customer    
bigserial
NN
ship_terms_name    
varchar(20)
NN
ship_terms_description    
text
simply lists it on the order. Not for us, but for them. But, if Pre-Paid, it automatically makes it a custom Trucking PO we make.
Languages
Key
languages_id    
serial
NN
language_name    
varchar(30)
NN
abbrev    
varchar(3)
NN
abbrev_alias    
varchar(3)
NN
language_orientation    
varchar(3)
NN
text    
text
section_key    
varchar(50)
NN
Each section title and any other text can be stored with a language identifier.
Inventory***
Key
inventory_id    
bigserial
NN
external_id    
uuid
NN
Key
web_app_customer    
bigserial
NN
Key
product_id    
bigserial
NN
Key
purchase_order_id    
bigserial
NN
Key
warehouse_id    
bigserial
NN
Key
lot_number    
varchar
NN
product_stock_level    
numeric(10, 2)
NN
on_special    
boolean
case_per pallet    
integer
case_ti    
integer
case_hi    
integer
list_price    
integer
NN
cost_price    
integer
NN
anniversary_date    
date
NN
comments    
text
tlc_code    
varchar(255)
pack_date    
date
pack_date_text    
varchar(20)
expire_date    
date
expire_date_text    
varchar(20)
received_in_date    
date
NN
received_in_at    
timestamptz
NN
Key
received_in_by_user_id    
bigserial
NN
last_modified    
timestamptz
Key
last_modified_user_id    
bigserial
NN
quantity    
integer
NN
lot_hold    
boolean
NN
search_vector    
tsvector
Products -> These are details that you set and don't change or add to. Inventory-> these are variable details that get assigned to prducts when received in.
Product***
Key
product_id    
bigserial
NN
external_id    
uuid
NN
Key
web_app_customer    
bigserial
NN
product_sku    
varchar(40)
quickbooks_product_id    
integer
product_size    
varchar
product_family    
varchar
NN
product_short_description    
varchar
NN
product_full_description    
varchar
pack_size    
varchar
Key
product_origin_id    
integer(3)
NN
upc_outer    
varchar
upc_inner    
varchar
partials_per_case    
integer
NN
case_net_weight    
integer
NN
case_gross_weight    
integer
NN
Key
product_utm_id    
varchar(4)
NN
Key
bill_by    
integer(2)
NN
Key
catch_method    
integer
NN
latin_name    
varchar
FAO    
varchar
Zone    
varchar
special_import_requirements    
varchar
dimensions    
varchar
average_lead_time    
integer
reorder_threshold    
integer
reorder_alert    
integer
low_inventory_alert    
integer
special_import_requirements    
varchar
sell_season_start1    
integer
sell_season_end1    
integer
sell_season_start2    
integer
sell_season_end2    
integer
sell_season_holiday    
varchar
sell_season_weather1    
varchar
sell_season_weather2    
varchar
sell_season_weather3    
varchar
sell_season_weather4    
varchar
upc_outercase    
varchar
upc_innercase    
varchar
dimensions    
varchar
product_spec_sheet1    
text
product_spec_sheet2    
text
product_spec_sheet3    
text
product_spec_sheet4    
text
product_spec_sheet5    
text
cooking_instructions1    
text
cooking_instructions2    
text
Key
Country_country_name    
varchar(50)
NN
Key
harvest_season_id    
serial
Key
product_photo_id    
uuid
is_deleted    
boolean
Key
product_document_id    
bigserial
Key
chart_of_accounts_type    
bigserial
NN
created_at    
timestamptz
NN
Key
created_by_user_id    
bigserial
NN
last_modified    
timestamptz
NN
Key
last_modified_user_id    
bigserial
NN
An idea with this is to be able to build a spec sheet if need be for web app customers instead of doing them by hand. A template will need to be made.
Catch_method
Key
catch_method_id    
serial
NN
Key
web_app_customer_id    
bigserial
NN
catch_method_name    
varchar
NN
description    
text
Advanced_settings**
Key
advanced_settings_id    
serial
NN
Key
web_app_customer    
bigserial
NN
set_po_number_global    
varchar
set_po_number_prefix    
boolean
NN
po_number_prefix_per_user    
boolean
quickbooks_integration_api    
varchar
warehouse_starting_order_number    
varchar
prefix_per_order_number_by_salesman    
boolean
global_snooze_setting    
varchar
will be a work in progress... Divvy up based off Inventory, CRM, etc...
Company_global_settings**
Key
id    
integer
NN
I think I need a global settings table to house customer settings. Advanced settings is for advanced settings that don't belong in standard settings like theme, langauage, time zone, ltr, etc. Global is the DEFAULT settings.
User_settings**
Key
user_settings_id    
serial
NN
Key
web_app_customer    
bigserial
NN
salesman_prefix_to_order_number    
varchar(6)
allow_sales_popcards    
boolean
I do want settings for a per user basis. For example, some like a specific theme whereas some like darkmode. I want to be able to offer that to them. Not sure if languages would be for global for the customer or on a per user basis. The issue is how would it be a specific language? Like, global is English, but the user is Spanish. Would an admin or manager be able to add another language description to the product? More things to consider and think out!!
Bill_by** (aka "Sell By")
Key
bill_by_id    
serial
NN
web_app_customer    
bigserial
NN
bill_by_name    
varchar
NN
description    
text
More in-depth thinking needs to figure what this is for specifically! would we need UTM???
Purchase Order Details
Key
purchase_order_id    
bigserial
NN
external_id    
uuid
NN
Key
web_app_customer    
bigserial
NN
Key
vendor_id    
bigserial
NN
pack_date    
date
expiration_date    
date
tlc_code    
varchar(30)
Key
purchase_order_items    
bigserial
purchase_order_type    
serial
NN
Purchase_order_sent    
timestamptz
NN
created_at    
timestamptz
NN
Key
created_by_user_id    
bigserial
NN
last_modified    
timestamptz
NN
Key
last_modified_user_id    
bigserial
NN
total_value    
integer
NN
status    
varchar(20)
NN
Vendors**
Key
vendor_id    
bigserial
NN
external_id    
uuid
NN
Key
web_app_customer    
bigserial
NN
vendor_name    
varchar(41)
NN
vendor_dba    
varchar(41)
vendor_nickname    
varchar(41)
preferred_vendor    
boolean
Key
vendor_type_id    
serial
vendor_specialties    
varchar(300)
NN
plant_number    
varchar(20)
plant_code    
varchar(20)
fda_registration_number    
varchar(20)
china_registration_number    
varchar(20)
canadian_registration_number    
varchar(20)
eu_registration_number    
varchar(20)
registration_number    
varchar(20)
Key
accounts_receivable_country_id    
integer(3)
accounts_receivable_zipcode    
varchar(10)
vendor_website    
varchar(100)
vendor_insured    
boolean
vendor_insured_coverage_amount    
varchar
paycargo    
boolean
paycargo_website    
varchar(300)
vendor_login_username    
varchar(100)
vendor_login_password    
varchar(100)
Key
Country_country_name    
varchar(50)
NN
Key
Vendor_type_vendor_type_name    
varchar(30)
NN
Key
vendor_product_id    
bigserial
Key
vendor_contact_id    
serial
Key
vendor_receivable_contact    
serial
Key
vendor_shipping_destination_id    
serial
created_at    
timestamptz
NN
Key
created_by_user_id    
bigserial
NN
last_modified    
timestamptz
NN
Key
last_modified_user_id    
bigserial
NN
**Need to figure out how to tie products to a specific vendor. Would it be divvy'd up with "vendor details" and "vendor products" I think the details are JOINed together with the Vendors table
Recalls** - NEED HELP
Key
recall_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
recall_real_or_mock    
boolean
NN
Key
inventory_product    
uuid
NN
Key
customer_orders    
uuid
NN
This is for recalls. *Might need to add another table or more for all the things pertaining to one.
Order Line Items
Key
order_item_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
Key
order_id    
bigserial
NN
Key
inventory_product_id    
bigserial
NN
Key
inventory_lot_number    
varchar
NN
product_quantity    
numeric(10,2)
NN
clean_out    
boolean
product_price    
numeric(10, 2)
price_is_delivered    
boolean
pallets_total    
numeric(10, 2)
NN
Considering it to be named "Order Products" This actually houses the items/products in the actual order. The Order table just houses the order details because customer_orders_id (changing to orders_id) has to be 1 number and it can't repeat. This is where multiple products can be added Same goes for Invoices... Same concept!
invoices
Key
invoice_id    
bigserial
NN
**How to void??
invoice_items
Key
invoice_item_id    
bigserial
NN
follows the same rule as Orders and Order Items tables
Global App Settings
Key
setting_id    
serial
NN
Key
setting_name    
varchar(100)
NN
setting_value    
text
NN
description_text    
text
NN
These are the main settings for the actual overall web app.
Popcards
Key
popcard_id    
uuid
NN
web_app_customer    
uuid
NN
popcard_name    
varchar
NN
popcard_value    
varchar
NN
This is for helping salesmen sell when they might be on a call or selling something to someone or a prospect.
Vendor_type
Key
vendor_type_id    
serial
NN
web_app_customer    
bigserial
NN
Key
vendor_type_name    
varchar(30)
NN
description    
text
Country
Key
country_id    
integer
NN
Key
country_name    
varchar(50)
NN
country_abreviation    
varchar(3)
NN
Vendor_products
Key
vendor_products_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
Key
vendor_id    
bigserial
NN
Key
vendor_products    
bigserial
Purchase Order Line Items
Key
purchase_order_item_id    
bigserial
NN
Key
purchase_order_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
Key
product_id    
bigserial
Key
service_id    
bigserial
quantity    
numeric(10, 2)
NN
total_price    
numeric(10, 2)
NN
unit_price    
numeric(10, 2)
NN
Key
vendor_id    
bigserial
NN
CHECK ( -- Ensure that either product_id or service_id is set, not both (product_id IS NOT NULL AND service_id IS NULL) OR (service_id IS NOT NULL AND product_id IS NULL) This makes sure that either or is NOT NULL. Might need to use "DECIMAL" as the data type.
Session
Key
session_id    
uuid
NN
Key
web_app_customer_id    
bigserial
NN
Key
user_id    
bigserial
NN
created_at    
timestamptz
expires_at    
timestamptz
NN
ip_address    
varchar(45)
NN
user_agent    
text
NN
mfa_verified    
boolean
NN
mfa_verified_at    
timestamptz
NN
This stores sessions for all users. It only stores 1 session per user.
Session Activities
Key
session_id    
uuid
NN
Key
user_id    
bigserial
NN
ip_address    
varchar(45)
NN
user_agent    
text
NN
location    
varchar(255)
NN
login_time    
timestamptz
NN
last_activity    
timestamptz
NN
This stores activities of the last 5 or 10(?) sessions of a user to help compare if there is any anomolies to trigger MFA (2-factor authentication).
Sub Accounts
Key
user_id    
bigserial
NN
Key
external_id    
uuid
NN
Key
web_app_customer_id    
bigserial
NN
username    
varchar(255)
NN
password_hash    
varchar(255)
NN
Key
user_role    
serial
NN
email    
varchar(100)
NN
cellphone    
varchar(21)
wechat    
varchar(50)
whatsapp    
varchar(50)
Key
language_id    
serial
NN
created_at    
timestamptz
is_deleted    
boolean
is_active    
boolean
updated_at    
timestamptz
disk_usage    
bigint
is_anonymized    
boolean
NN
deleted_at    
timestamptz
MFA Token
Key
token_id    
uuid
NN
Key
user_id    
bigserial
NN
token    
varchar(6)
NN
expires_at    
timestamptz
NN
is_used    
boolean
NN
created_at    
timestamptz
NN
Backup Codes
Key
code_id    
uuid
NN
Key
user_id    
bigserial
NN
backup_code    
varchar(12)
NN
is_used    
boolean
User Role
Key
user_id    
bigserial
Key
role_id    
serial
Settings
Key
setting_id    
serial
NN
setting_name    
varchar(100)
NN
setting_value    
text
NN
Role Settings
Key
role_id    
serial
NN
Key
setting_id    
serial
NN
Using Aproach 2 Conection Limit 5 (max by user_id or by IP). user_id might be best. But maybe 2 or 3 connections max. I would have to see if browser tabs open relate to this max connection. But, it might be based off browser id... Idk?
User Specific Settings
Key
user_id    
uuid
NN
Key
setting_name    
varchar(100)
NN
setting_value    
text(100)
NN
Feature Specific Settings
Key
feature_setting_id    
serial
NN
feature_name    
varchar(100)
NN
setting_name    
varchar(100)
NN
setting_value    
text
NN
description_text    
text
NN
These are module specific settngs. IE: CRM, Inventory, Products Site, Accounting, etc...
System Settings
Key
setting_id    
serial
NN
setting_name    
varchar(100)
NN
setting_value    
text
NN
sensitive    
boolean
NN
description_text    
text
NN
Not sure if I need this. It seems to be a table used for admins for low-level settings. But, IDK...
Customer Buyers
Key
customer_buyer_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
buyer_position    
varchar(50)
buyer_firstname    
varchar(50)
NN
buyer_lastname    
varchar(50)
buyer_email    
varchar(100)
buyer_phone    
varchar(21)
buyer_phone_ext    
varchar(10)
buyer_phone_direct    
varchar(21)
buyer_mobile    
varchar(21)
buyer_mobile_sms    
boolean
buyer_wechat    
varchar(50)
buyer_whatsapp    
varchar(50)
is_deleted    
boolean
This is for housing more than 1 buyer per customer. Keep adding details to it!
Customer Delivery Addresses
Key
customer_delivery_address_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
delivery_label    
varchar(40)
delivery_attn    
varchar(40)
delivery_location_name    
varchar(50)
deliver_address1    
varchar(60)
NN
delivery_address2    
varchar(60)
delivery_address_city    
varchar(57)
NN
delivery_address_state    
varchar(50)
NN
delivery_address_country_id    
integer(3)
NN
delivery_address_zipcode    
varchar(8)
delivery_address_phone    
varchar(21)
NN
delivery_address_email    
varchar(100)
delivery_address_file_location    
text
delivery_address_website    
text
This is for housing more than 1 delivery address per customer
Customer Accounting Contacts
Key
customer_accounting_contact_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
accounting_contact_name    
varchar(50)
accounting _contact_phone    
varchar(21)
accounting_contactphone_ext    
varchar(10)
accounting_contact_email    
varchar(100)
This is for housing more than accounant per customer
Vendor Contacts
Key
vendor_contact_id    
serial
NN
Key
web_app_customer    
bigserial
NN
vendor_contact_nickname    
varchar(50)
vendor_contact_firstname    
varchar(50)
vendor_contact_lastname    
varchar(50)
vendor_contact_phone    
varchar(21)
vendor_contact_phone_ext    
varchar(10)
vendor_contact_cellphone    
varchar(21)
vendor_contact_sms    
boolean
vendor_contact_wechat    
varchar(50)
vendor_contact_whatsapp    
varchar(50)
vendor_contact_email    
varchar(100)
NN
created_at    
timestamptz
NN
Key
created_by_user_id    
bigserial
NN
last_modified    
timestamptz
NN
Key
last_modified_user_id    
bigserial
NN
Some of the fields like "created_at" and "last_modified" might be for internal or deeper things for insights in the future...
Vendor Receivable Contacts
Key
vendor_receivable_contact_id    
serial
NN
Key
web_app_customer    
bigserial
NN
vendor_receivable_firstname    
varchar(50)
vendor_receivable_lastname    
varchar(50)
vendor_recivable_phone    
varchar(21)
vendor_receivable_phone_ext    
varchar(10)
vendor_receivable_cellphone    
varchar(21)
vendor_receivable_email    
varchar(100)
vendor_receivable_fax    
varchar(21)
vendor_receivable_qq    
varchar(50)
vendor_receivable_wechat    
varchar(50)
vendor_receivable_whatsapp    
varchar(50)
created_at    
timestamptz
NN
Key
created_by_user_id    
bigserial
NN
last_modified    
timestamptz
NN
Key
last_modified_user_id    
bigserial
NN
Vendor Shipping Destination
Key
vendor_shipping destination_id    
serial
NN
Key
web_app_customer    
bigserial
NN
Key
vendor_shipping_destination    
varchar(100)
NN
Product Harvest Season
Key
harvest_season_id    
serial
NN
Key
web_app_customer    
bigserial
NN
harvest_season_name    
varchar(40)
NN
harvest_season_start    
varchar(40)
NN
harvest_season_end    
varchar(40)
NN
description    
text
created_at    
timestamptz
Product Photos
Key
product_picture_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
product_picture_filename    
text
NN
product_picture_filepath    
text
NN
product_photo_original_size    
integer
product_photo_compressed_size    
integer
product_photo_upload_date    
timestamptz
**How to resize images to a specific size? Need to use Python app
Product UTM
Key
product_utm_id    
serial
NN
Key
product_utm_name    
varchar(20)
NN
Key
product_utm_abbv    
varchar(4)
NN
description    
text
Is the product sold by the lb, case, etc.?
Warehouse Operation Days
Key
warehouse_operation_days_id    
serial
NN
Key
web_app_customer_id    
bigserial
NN
operation_day_name    
varchar(40)
NN
operation_day_shipping_start_hour    
time
NN
operation_day_shipping_end_hour    
time
NN
operation_day_receiving_start_hour    
time
NN
operation_day_receiving_end_hour    
time
NN
operation_day_orders_start_hour    
time
NN
operation_day_orders_end_hour    
time
NN
Logic will split the data up into separate areas for viewing. If days have the same "time" then only 1 will be shown and the 1st day of the week till the end will be. A potential issue is do I set Sunday-Saturday as the start of the week or Monday-Sunday??? Global standard might be it...
Warehouse Contacts
Key
warehouse_contact_id    
serial
NN
Key
web_app_customer_id    
bigserial
NN
Key
contact_type    
serial
NN
contact_phone    
varchar(21)
contact_phone_ext    
varchar(10)
contact_email    
varchar(100)
contact_cellphone    
varchar(21)
contact_sms    
boolean
contact_fax    
varchar(21)
is_deleted    
boolean
Warehouse Contact Type
Key
warehouse_contact_type_id    
serial
NN
Key
web_app_customer    
bigserial
NN
Key
contact_type_name    
varchar(40)
NN
Customer Order Confirm Contact
Key
customer_order_confirm_contact_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
order_confirm_contact_name    
varchar(40)
order_confirm_contact_email    
varchar
NN
Reminders
Key
reminders_id    
bigserial
NN
Key
user_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
reminder_title    
varchar(255)
NN
reminder_description    
text
reminder_time    
timestamptz
NN
is_recurring    
boolean
rexurring_interval    
varchar(50)
reminder_created_at    
timestamptz
is_deleted    
boolean
Notifications
Key
notifications_id    
bigserial
NN
Key
reminders_id    
bigserial
NN
notification_time    
timestamptz
NN
notification_status    
varchar(50)
Subscription Plans
Key
subscription_plans_id    
integer
NN
subscription_plan_name    
varchar(255)
NN
max_sub_accounts    
integer
NN
subscription_price    
money
NN
subscription_duration_in_days    
integer
NN
subscription_start_date    
timestamptz
subscription_end_date    
timestamptz
Key
currency_id    
serial
features    
text
Currencies
Key
currency_id    
serial
NN
currency_code    
varchar(3)
currency_symbol    
varchar(10)
currency_exchange_rate    
integer(10, 6)
NN
Subscription Addons
Key
subscription_addons_id    
serial
NN
addon_name    
varchar(255)
NN
addon_description    
text
addon_price    
money
NN
duration_in_days    
integer
NN
created_at    
timestamptz
updated_at    
timestamptz
EXAMPLE: INSERT INTO subscription_addons (name, description, price, duration_in_days) VALUES ('50 GB Storage', 'Add 50 GB of storage to your plan.', 10.00, 30), ('100 GB Storage', 'Add 100 GB of storage to your plan.', 18.00, 30);
User Subscriptions
Key
user_subscriptions_id    
serial
NN
Key
customer_id    
uuid
Key
subscription_plan_id    
integer
stripe_subscription_id    
varchar(255)
NN
stripe_payment_intent_id    
varchar(255)
amount_paid    
money
NN
Key
currency_id    
serial
NN
payment_status    
varchar(50)
NN
billing_start    
timestamptz
NN
billing_end    
timestamptz
NN
created_at    
timestamptz
updated_at    
timestamptz
status    
varchar(50)
disk_quota    
bigint
NN
User Addons
Key
user_addons_id    
serial
NN
Key
user_subscription_id    
serial
Key
subscription_addon_id    
serial
quantity    
integer
created_at    
timestamptz
updated_at    
timestamptz
Chart of Accounts
Key
accounts_id    
bigserial
NN
external_id    
uuid
NN
Key
web_app_customer_id    
bigserial
NN
account_name    
varchar(100)
NN
account_type    
varchar(50)
NN
created_at    
timestamptz
NN
Key
created_by_user_id    
bigserial
NN
last_modified    
timestamptz
NN
Key
last_modified_user_id    
bigserial
NN
Order Statuses
Key
order_status_id    
serial
NN
Key
web_app_customer    
bigserial
NN
status_name    
varchar(255)
NN
status_description    
text
is_active    
boolean
created_at    
timestamptz
Product Documents
Key
product_document_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
product_document_filepath    
varchar(255)
NN
product_document_filename    
varchar(255)
product_document_file_size    
bigint
uploaded_at    
timestamptz
Photos
Key
company_photo_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
company_photo_filename    
text
NN
company_photo_filepath    
text
NN
company_photo_original_size    
integer
company_photo_compressed_size    
integer
photo_file_ext    
varchar(50)
company_photo_upload_date    
timestamptz
Key
photo_type_id    
serial
Key
post_id    
bigserial
**How to resize images to a specific size? Need to use Python app
Documents
Key
product_document_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
product_document_filepath    
varchar(255)
NN
product_document_filename    
varchar(255)
product_document_file_size    
bigint
uploaded_at    
timestamptz
last_modified    
timestamptz
Key
post_id    
bigserial
Photo Types
Key
photo_type_id    
serial
NN
Key
web_app_customer    
bigserial
NN
photo_type_name    
varchar(255)
NN
description    
text
created_at    
timestamptz
last_modified    
timestamptz
Used for company internal things. Ex: Logo, trademarks, brands, etc. Sepcial photos...
Notes
Key
note_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
Key
user_id    
bigserial
NN
external_id    
uuid
NN
Key
customer_id    
bigserial
note_content    
text
NN
created_at    
timestamptz
last_modified    
timestamptz
reminder_at    
timestamp
reminder_triggered    
boolean
Blog Posts
Key
post_id    
bigserial
NN
Key
user_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
external_id    
uuid
NN
title    
varchar(255)
NN
content    
text
NN
created_at    
timestamptz
updated_at    
timestamptz
published    
boolean
This is the equivalent of the Doc's Report on the Products Site.
Comments*
Key
comment_id    
bigserial
NN
Key
user_id    
bigserial
Key
customer_user_id    
bigserial
Key
web_app_customer    
bigserial
NN
Key
post_id    
bigserial
NN
external_id    
uuid
NN
title    
varchar(255)
NN
content    
text
NN
created_at    
timestamptz
updated_at    
timestamptz
published    
boolean
By default, this is OFF! This is in case we eventually open it up to external people. Better to have it setup then to not.
Customer Users*
Key
customer_user_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
Key
customer_role_id    
serial
NN
username    
varchar(255)
NN
password_hash    
varchar(255)
NN
email    
varchar(100)
NN
cellphone    
varchar(21)
wechat    
varchar(50)
whatsapp    
varchar(50)
Key
language_id    
serial
NN
created_at    
timestamptz
is_deleted    
boolean
is_active    
boolean
updated_at    
timestamptz
Purpose is for being able to either comment on blog posts or view pertinent information regarding their company. Example: Broker View, Outstanding invoices they haven't paid, statements, etc.
Customer Roles
Key
role_id    
serial
NN
role_name    
varchar(30)
NN
role_permission    
integer
NN
You can name roles here. Need to figure out how it works
Customer User Role
Key
customer_user_id    
bigserial
Key
customer_role_id    
serial
Customers need logins, but they also need different roles. Such as: accounts payable, salesman, broker view, etc.
Customer Settings
Key
setting_id    
serial
NN
setting_name    
varchar(100)
NN
setting_value    
text
NN
Customer Role Settings
Key
role_id    
serial
NN
Key
setting_id    
serial
NN
Using Aproach 2
Categories
Key
category_id    
serial
NN
Key
web_app_customer    
bigserial
category_name    
varchar(100)
NN
Post Categories
Key
post_id    
serial
NN
Key
category_id    
serial
NN
Key
web_app_customer    
bigserial
NN
Tags
Key
tags_id    
serial
NN
Key
web_app_customer    
bigserial
tags_name    
varchar(100)
NN
Post Tags
Key
post_id    
serial
NN
Key
tag_id    
serial
NN
Key
web_app_customer    
bigserial
NN
Likes
Key
likes_id    
bigserial
NN
Key
web_app_customer    
bigserial
NN
Key
post_id    
serial
NN
Key
user_id    
bigserial
Key
customer_user_id    
bigserial
created_at    
timestamptz
Timezones
Key
timezone_id    
integer
NN
timezone_name    
varchar(100)
NN
timezone_offset    
varchar(6)
NN
timezone_translation    
varchar(100)
NN
description    
text
Storage Calculations
Key
id    
integer
NN
Helping figure out storage calculations**
Services***
Key
service_id    
bigserial
NN
external_id    
uuid
NN
Key
web_app_customer    
bigserial
NN
quickbooks_service_id    
integer
service_name    
varchar(255)
NN
description    
text
Key
chart_of_accounts_type    
bigserial
NN
created_at    
timestamptz
NN
Key
created_by_user_id    
bigserial
NN
last_modified    
timestamptz
NN
Key
last_modified_user_id    
bigserial
NN
Need to EXPOUND on this!!! Can't receive it in, but bills can be associated with it. Need to research more!!!
Product Receipts***
Key
product_receipt_id    
bigserial
NN
external_id    
uuid
NN
Key
web_app_customer    
bigserial
NN
received_in_at    
timestamptz
NN
Key
received_in_by_user_id    
bigserial
NN
last_modified    
timestamptz
NN
Key
last_modified_by_user_id    
bigserial
NN
This is for receiving in products to "Inventory" and then we push/copy the info over to Inventory.
Journal Entries
Key
entry_id    
bigserial
NN
external_id    
uuid
NN
web_app_customer_id    
bigserial
NN
transaction_date    
timestamptz
NN
description    
text
Journal Entries Line Items
Key
line_item_id    
bigserial
NN
Key
entry_id    
bigserial
NN
web_app_customer_id    
bigserial
NN
Key
account_id    
bigserial
debit    
numeric(10, 2)
credit    
numeric(10, 2)
Need to use DECIMAL
Emails
Key
email_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
Key
user_id    
bigserial
NN
recipient    
text
NN
subject    
text
NN
body    
text
NN
sent_at    
timestamptz
NN
reply_token    
uuid
NN
status    
text
NN
is_html    
boolean
Emails Replies
Key
email_reply_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
Key
user_id    
bigserial
NN
Key
email_id    
bigserial
NN
reply_body    
text
NN
received_at    
timestamptz
NN
is_html    
boolean
Email Accounts
Key
email_accounts_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
Key
user_id    
bigserial
NN
email_address    
text
NN
imap_server    
text
NN
imap_port    
integer
NN
smtp_server    
text
NN
smtp_port    
integer
NN
username    
text
NN
password    
text
NN
created_at    
timestamptz
NN
updated_at    
timestamptz
NN
This is for storing the actual email credentials for each web app customer's sub account. Reason why for an individual is that some salesman might be using their own gmail account logins to send emails or own web server sending IMAP settings.
Custom Order Instructions
Key
custom_order_instructions_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
Key
user_id    
bigserial
NN
Key
customer_id    
bigserial
NN
Key
warehouse_id    
bigserial
NN
instructions_text    
text
NN
Used for setting up Customer Defaults
Action Logs
Key
action_log_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
Key
user_id    
bigserial
NN
action    
varchar(255)
NN
details    
jsonb
created_at    
timestamptz
NN
This is for logging actions for all users. Early on this is crucial. But later on, it will become a pain point. Being able to offload this to some other database might be ideal. This will help keep the database running quickly.
files
Key
files_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
Key
user_id    
bigserial
NN
file_name    
varchar(255)
NN
file_size    
bigint
NN
file_path    
text
NN
created_at    
timestamptz
NN
modified_at    
timestamptz
FOREIGN KEY (user_id) REFERENCES Sub Accounts (user_id) ON DELETE CASCADE
Shared Inventory
Key
shared_intentory_id    
bigserial
NN
web_app_customer_id    
bigserial
NN
user_id    
bigserial
NN
public_url    
bigserial
NN
created_at    
timestamptz
NN
Shared Inventory Details
Key
shared_intentory_details_id    
bigserial
NN
Key
shared_inventory_id    
bigserial
NN
Key
inventory_id    
bigserial
NN
product_details    
varchar(255)
NN
This is able to pull in Inventory which allows you to pull in product details. This is why Relationships exist. To make it faster and have less space.
Data Processing Audit
Key
data_processing_audit_id    
integer
NN
Key
web_app_customer_id    
bigserial
NN
Key
user_id    
bigserial
NN
action    
varchar(255)
NN
processed_at    
timestamptz
NN
You need a table to track processing activities for personal data. This ensures transparency and records compliance. Use Case: Record every action involving personal data. For example: - File uploads or deletions. - Sub-account creation or deletion. - Changes to user details (e.g., email or username).
Data Deletion Logs
Key
data_deletion_log_id    
integer
NN
Key
web_app_customer_id    
bigserial
NN
Key
user_id    
bigserial
NN
entity_type    
varchar(50)
NN
entity_id    
bigserial
NN
deletion_reason    
text
deleted_at    
timestamptz
NN
To support the right to erasure (Article 17), log data deletions for accountability. Use Case: This table tracks when and why data was deleted, ensuring compliance with the "right to be forgotten."
User Consents
Key
user_consent_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
Key
user_id    
bigserial
NN
consent_type    
varchar(255)
NN
consent_given    
boolean
NN
consented_at    
timestamptz
NN
Purchase Order Vendors
Key
purchase_order_vendors_id    
bigserial
NN
Key
purchase_order_id    
bigserial
NN
Key
web_app_customer_id    
bigserial
NN
Key
vendor_id    
bigserial
NN
vendor_amount    
numeric(10, 2)
NN
status    
varchar(20)
NN
external_id    
uuid
NN
This table is to support the ability to do "split-POs". Meaning, havng 2 vendors on the same PO. This is usually an anomoly for us, but, it does happen. This ALSO allows me to convert a single vendor PO into a Split-PO. Pretty trick!
Inventory Revision Log
Key
inventory_revision_log_id    
bigserial
NN
external_id    
uuid
NN
web_customer_id    
bigserial
NN
Key
inventory_id    
bigserial
NN
Key
product_id    
bigserial
NN
old_lot_number    
varchar(20)
NN
new_lot_number    
varchar(20)
NN
quantity    
integer
NN
action    
varchar(50)
NN
change_timestamp    
timestamptz
NN
Key
change_by_user_id    
bigserial
NN
Transfer Log
Key
transfer_log_id    
bigserial
NN
external_id    
uuid
NN
Key
web_customer_id    
bigserial
NN
Key
from_warehouse_id    
bigserial
NN
Key
to_warehouse_id    
bigserial
NN
old_lot_number    
varchar(20)
NN
new_lot_number    
varchar(20)
NN
quantity    
integer
NN
transfer_timestamp    
timestamptz
NN
Key
transferred_by_user_id    
bigserial
NN

*Add Primary Keys,

They don't need a relation to them to be one!

*Will need to revise PKs and FKs

How to be able to offer multiple languages?

How to do double-entry

for inventory???

Double Entry Accounting

Add external_id to all tables.

Replace UUID for customer_id with bigserial


This is known as the "Hybrid Approach"

*Reminders need to use TIMESTAMP

They are in "local time". No sense utilizing TIMESTAMPZ.

*Scheduling stuff would be in TIMESTAMP as well

They are in "local time". No sense utilizing TIMESTAMPZ.

**Pricelist Sending TIMESTAMPZ

They traverse multiple times.

**Sending emails in the web app use TIMESTAMP

Local time is what is needed

Pricelist Portion

Add: ^^^^^

user_id for any table; and for any table that has "last_modified" & "created_at" in it. This is used to track changes made by users and any potential for users to "self sabotage a company" and who maybe did an order.


Documentation for project Inventory 2
Inventory 2
Project
Name
Inventory 2
Description
Version 2 since version 1 was locked...
Diagram
Name
Main Diagram
Report
Generated
1/27/2025 | 11:02:00 PM
tables
Name
Warehouse
Description
List of warehouses and Cold Storages. Should have logic in that if a product has a cold storage linked to it, it can't be deleted.
Columns
Name
Data type
Param
Key
Not Null
warehouse_id
bigserial
Yes
Yes
Description
*Thought is to use this for the Customer's ID in the system.
external_id
uuid
Yes
web_app_customer
bigserial
Yes
warehouse_dba
varchar
warehouse_name_listed
varchar
Yes
warehouse_location
varchar
Yes
online_inventory_website
text
online_inventory_username
varchar
online_inventory_password
varchar
qbs_warehouse_location_id
varchar
address1
varchar
Yes
address2
varchar
city
varchar
Yes
state
varchar
country
integer
3
Yes
zipcode
varchar
Yes
billing_address1
varchar
billing_address2
varchar
billing_address_city
varchar
billing_address_state
varchar
billing_address_country
integer
3
billing_address_zipcode
varchar
contact
varchar
Yes
allow_same_day_orders
boolean
Description
false = no, true = yes
billable
boolean
Yes
Description
Yes allows you to bill them as a customer in an unlikely event. No removes them from the billing when it comes to customers. This can be set as yes and no at anytime. No is the default. **It would be cool to be able to switch them on and off even if you have billed them in the past. Will need to see if that's possible or if possible to select a checkmark for billing vendors or have vendors listed at the bottom and they can't be "instant searched" when billing a customer. Sort of like an entry on the dropdown at the very bottom.
timezone
integer
2
Yes
repack_capabilities
varchar
dry_ice
varchar
pallet_charge_a
integer
pallet_charge_b
integer
lumping_fee
integer
ctr_unloading_fee
integer
damage_control
boolean
own_pallet_with_product
varchar
pallet_exchange
boolean
rate_sheet
varchar
warehouse_holidays
varchar
Country_country_name
varchar
50
Yes
Country_country_name
varchar
50
Yes
operation_days
serial
Yes
is_deleted
boolean
Description
DEFAULT FALSE This allows us to hide/archive for auditing purposes in the future
Keys
Warehouse_pkey
Column in Warehouse_pkey
warehouse_id
Warehouse_key
Warehouse_key1
Column in Warehouse_key1
web_app_customer
Warehouse_key2
Column in Warehouse_key2
web_app_customer
Warehouse_key3
Column in Warehouse_key3
operation_days
Warehouse_key4
Column in Warehouse_key4
web_app_customer
Warehouse_key5
Column in Warehouse_key5
contact
Warehouse_key6
Column in Warehouse_key6
web_app_customer
Name
Customers
Description
Since ANY and ALL Sales data is listed under the Sales table, it is accessable via the Customer UUID and UUID of the Sale. Therefore, anything that is associated on a separate table will be JOINed together on the frontend. Routing seems hectic, but it makes sense database wise.
Columns
Name
Data type
Param
Key
Not Null
customer_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer
bigserial
Yes
Description
Might need to change the label of this, but for now it is listed as this.
customer_name
varchar
41
Yes
customer_dba
varchar
41
customer_name_listed_as
varchar
41
used_to_be_called
varchar
41
used_to_be_called_date_change
date
user_id
bigserial
Yes
Description
salesman
quickbooks_cust_id
varchar
erp_custom_id
varchar
customer_type_id
integer
Yes
order_frequency
integer
order_frequency_days
integer
avg_order_day
varchar
address1
varchar
60
address2
varchar
60
city
varchar
57
state
varchar
50
country_id
integer
3
zipcode
varchar
10
billing_company_name
varchar
60
billing_address1
varchar
60
billing_address2
varchar
60
billing_city
varchar
57
billing_state
varchar
50
billing_country_id
integer
3
billing_zipcode
varchar
8
send_invoice_mail_id
boolean
send_invoice_email_id
boolean
send_order_confirm
boolean
order_confirm_by_email
boolean
order_confirm_by_sms
boolean
order_confirm_by_wechat
boolean
order_confirm_by_whatsapp
boolean
order_confirm_buyer
boolean
bill_by_dba
boolean
vendor_number
varchar
25
credit_insured
boolean
credit_limit
integer
15
payment_terms
integer
2
payment_type
integer
2
average_pay_time
integer
3
current_balance_owed
integer
18
sales_order_default
integer
2
order_shipping_vendor_default_id
integer
2
order_shipping_collect_default
integer
2
email_sending_category_id
integer
3
product_customer_usually_buys
varchar
Description
This runs a check and see what is the usual product they buy. But should I factor in how many times it appears on an order or base it by cases? I think base it by order as the best thing.
Country_country_name
varchar
50
Yes
buyer_id
bigserial
delivery_address
bigserial
accounting_contact
bigserial
is_deleted
boolean
Description
DEFAULT FALSE This allows us to hide/archive for auditing purposes in the future
status
varchar
50
Payment_terms_web_customer_id
bigserial
Yes
Payment_type_web_app_customer_id
bigserial
Yes
Keys
Customers_pkey
Column in Customers_pkey
customer_id
Customers_key
Customers_key1
Column in Customers_key1
web_app_customer
Customers_key2
Column in Customers_key2
web_app_customer
Customers_key3
Column in Customers_key3
web_app_customer
Customers_key4
Column in Customers_key4
buyer_id
Customers_key5
Column in Customers_key5
delivery_address
Customers_key6
Column in Customers_key6
accounting_contact
Name
Order Details - COME BACK TO! NEED MORE WORK!
Description
This is the barebones table. It will utilize IDs to make it quick! ANYTHING that is listed in another table can be pulled up from just using the ID from another table and joining the details. Crazy! This means I don't add the following: customer billing city and state, This pertains to the specific details of this order. Order Items pertains to all the products apart of the order! **Since pulling the customer over by the UUID, do I really need to have the data of the following or can I just JOIN or grab it:? Billing City and Billing State ??? Why are there PKs that I can't delete??? Need to do more research on when to PK and Not. Also, need to do FKs, but need to know how to later!
Columns
Name
Data type
Param
Key
Not Null
order_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer
bigserial
Yes
customer_id
bigserial
Yes
customer_billing_city
uuid
Yes
customer_billing_state
integer
Yes
customer_po_number
varchar
25
Yes
salesman_entered_order
integer
Yes
warehouse_id
uuid
Yes
order_type_id
serial
Yes
order_rush
boolean
Description
DEFAULT FALSE
order_number
varchar
Yes
order_sent_on
timestamptz
Yes
Description
same as order date. This is when it was actually sent in.
trucker_id
uuid
Description
this is the vendor ID, but specifically vendors that are SHIPPERS
ship_term
integer
Description
need to see how to grab defaults from a specific customer and add it into here...
order_first_created_date
timestamptz
Yes
special_instructions_note
varchar
300
inventory_product_id
uuid
Yes
Description
Utilizing JOIN to pull in the Lot#'s for this to be shown. Inventory Products do not ever get deleted*. This is for traceability and record keeping. Maybe we can have a calculated "vault" storage plan for storing records after a certain period of time. Company policy is delete after (need to set a period of time). The initial is difficult since we are currently BUILDING storage and we don't know what the projected calculated storage will be. *Maybe utilizing Citrus Extension for SHARDING the db will allow us to horizontally expand the db since we will be storing lots of data. **Just some thoughts..
is_voided
boolean
Description
DEFAULT FALSE This allows us to hide/archive the order for auditing purposes in the future
order_status_id
serial
Yes
created_at
timestamptz
Yes
Description
DEFAULT CURRENT_TIMESTAMPZ
last_modified
timestamptz
Yes
order_sent_in
timestamptz
Yes
order_confirmed_back
timestamptz
shipping_bol
varchar
50
trucking_po
bigserial
Description
Need to figure out how to associate a Trucking PO with this since I'm thinking of just doing a PO system for ALL instead of separate... Truckers are vendors and they provide for a service... Maybe have "Service POs"??
total_pallets
numeric
10, 2
Yes
Description
total pallets are the combinations of anything over .1 = 1 pallet. Therefore, it totals all pallets for the Line Items.
assumed_total_pallets
numeric
10, 2
Yes
Description
This takes the pallet decimal total and it adds it up in totality to show the entire pallet total. Then that number that is over .1 is considered a full other pallet. Have a note disclosure of "*If everything is combined on a pallet, then the total is this."
user_id
bigserial
Yes
last_modified_by
bigserial
Yes
Keys
customers_uuid
Column in customers_uuid
order_id
Orders - COME BACK TO! NEED MORE WORK!_key
Column in Orders - COME BACK TO! NEED MORE WORK!_key
web_app_customer
Order Details - COME BACK TO! NEED MORE WORK!_key
Column in Order Details - COME BACK TO! NEED MORE WORK!_key
order_status_id
Name
Web_App_Customer
Description
This is the master list of the web app customers. Company IDs are assigned in here and those are the UUIDs. Allowsing SOFT DELETE for the system. Hard Deteting for select options. Most are SOFT DELETE via is_delete or is_voided
Columns
Name
Data type
Param
Key
Not Null
web_app_customer_id
bigserial
Yes
Yes
external_id
uuid
Yes
company_name
varchar
41
Yes
name
varchar
255
Yes
email
varchar
255
Yes
Description
UNIQUE --? But what if someone has multiple email accounts for the same company...???
language_id
serial
Yes
created_at
timestamptz
Yes
Description
NOW()
updated_at
timestamptz
Yes
Description
NOW()
last_active
timestamptz
Description
DEFAULT TIMESTAMPZ
is_inactive
boolean
Description
DEFAULT FALSE
inactive_since
timestamptz
Description
INACTIVE in general is for the system to automatically delete users who have not used the system for a set period of time. In this case, it would be the company that has users and the activity is based off them interacting with the system. I'm thinking after 18 months or 24 months is when we delete them entirely. We will have to ustilize ON CASCADE DELETE as the logic to do this for us. Best practice is to send a warning email to the company admin notifying them that they have 30 days in order to re-active their account. In our case, we are paid and we need to have a column attached to this to be another indicator on not to delete them out of the system.
undeleteable
boolean
Description
This is so we can have a demo or our own company on here that will never be deleted and is a master list/record account.
payment_status
varchar
Yes
Description
deciding if I need this, but the thought is to have a status for a customer. ie: current, trial, defaulted, etc. current - paid, trial - 30 days (need to know how to do this...), defaulted - payment did not go through (need a grace period of a week so they are not screwed if they have money problems.
is_on_trial
boolean
Description
DEFAULT TRUE -- Tracks whether the main customer is on trial
trial_start_date
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ -- Start date of the trial
trial_end_date
timestamptz
Description
-- End date of the trial (30 days from start)
is_subscription_active
boolean
Description
DEFAULT FALSE -- Whether the customer has an active subscription
subscription_plan_id
integer
billing_start_date
timestamptz
Yes
billing_end_date
timestamptz
Yes
is_deleted????
boolean
Description
DEFAULT FALSE This allows us to hide/archive for auditing purposes in the future. Also allows us to RESTORE a user if they accidentally deleted their account or went dormant at a certain point. ****Thinking to replace this with "deleted_at" to be compatible with GDPR.
disk_quota
bigint
Yes
Description
DEFAULT 0
is_anonymized
boolean
Yes
Description
DEFAULT FALSE Instead of fully deleting users, replace personal identifiers (e.g., username, email) with placeholders and set is_anonymized = TRUE.
deleted_at
timestamptz
Description
GDPR requires defining retention periods for personal data (e.g., files, logs, or user accounts). Add a deleted_at column to relevant tables to mark when records are soft-deleted. ****Soft-Deletion is the name of the game. Then a 30 Day added to this is when the deltion occurs. I think maybe 31 days as a grace period is what might be better. But, idk. 30 Days would be the default. Multiple emails and 2 stage verification to ensure deletion should be required! Sort of like delting a domain name.
Keys
Web_App_Customer_pkey
Column in Web_App_Customer_pkey
web_app_customer_id
Web_App_Customer_key
Column in Web_App_Customer_key
subscription_plan_id
Relations
Name
Parent
Child
Name
Order_Type
Columns
Name
Data type
Param
Key
Not Null
order_type_id
serial
Yes
Yes
external_id
uuid
Yes
web_app_customer
bigserial
Yes
order_type_name
varchar
30
description
text
Keys
Order_Type_pkey
Column in Order_Type_pkey
order_type_id
Name
Roles
Description
You can name roles here. Need to figure out how it works
Columns
Name
Data type
Param
Key
Not Null
role_id
serial
Yes
Yes
role_name
varchar
30
Yes
role_permission
integer
Yes
Description
need to see how to give or add more permissions to a specific role.... Or if integer is the right value
Keys
Roles_pkey
Column in Roles_pkey
role_id
Name
Customer_Type
Description
Think this will be a table, but not fully sure. Still processing and thinking things through. Same as Sellable table...
Columns
Name
Data type
Param
Key
Not Null
customer_type_id
integer
Yes
Yes
customer_type_name
varchar
sellable
varchar
Keys
Customer_Type_pkey
Column in Customer_Type_pkey
customer_type_id
Name
Sellable
Description
More thought needs to go into this! Currently added, but more thought out is needed!
Columns
Name
Data type
Param
Key
Not Null
sellable_id
integer
Yes
Yes
sellable_type
varchar
50
Keys
Sellable_pkey
Column in Sellable_pkey
sellable_id
Name
Payment_terms
Description
Need to think this one through more as well!!
Columns
Name
Data type
Param
Key
Not Null
web_customer_id
bigserial
Yes
Yes
payment_terms_id
integer
Yes
Yes
payment_days
integer
Yes
payment_name
integer
Yes
Keys
Payment_terms_pkey
Column in Payment_terms_pkey
payment_terms_id
Column in Payment_terms_pkey
web_customer_id
Name
Payment_type
Columns
Name
Data type
Param
Key
Not Null
web_app_customer_id
bigserial
Yes
Yes
payment_type_id
integer
Yes
Yes
payment_type_name
varchar
50
Yes
Keys
Payment_type_pkey
Column in Payment_type_pkey
payment_type_id
Column in Payment_type_pkey
web_app_customer_id
Name
Ship_terms
Description
simply lists it on the order. Not for us, but for them. But, if Pre-Paid, it automatically makes it a custom Trucking PO we make.
Columns
Name
Data type
Param
Key
Not Null
ship_terms_id
integer
Yes
Yes
web_app_customer
bigserial
Yes
ship_terms_name
varchar
20
Yes
ship_terms_description
text
Keys
Ship_terms_pkey
Column in Ship_terms_pkey
ship_terms_id
Name
Languages
Description
Each section title and any other text can be stored with a language identifier.
Columns
Name
Data type
Param
Key
Not Null
languages_id
serial
Yes
Yes
language_name
varchar
30
Yes
abbrev
varchar
3
Yes
abbrev_alias
varchar
3
Yes
language_orientation
varchar
3
Yes
text
text
section_key
varchar
50
Yes
Keys
Languages_pkey1
Column in Languages_pkey1
languages_id
Name
Inventory***
Description
Products -> These are details that you set and don't change or add to. Inventory-> these are variable details that get assigned to prducts when received in.
Columns
Name
Data type
Param
Key
Not Null
inventory_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer
bigserial
Yes
product_id
bigserial
Yes
purchase_order_id
bigserial
Yes
warehouse_id
bigserial
Yes
lot_number
varchar
Yes
product_stock_level
numeric
10, 2
Yes
Description
DEFAULT 0
on_special
boolean
case_per pallet
integer
case_ti
integer
case_hi
integer
list_price
integer
Yes
cost_price
integer
Yes
anniversary_date
date
Yes
comments
text
tlc_code
varchar
255
pack_date
date
pack_date_text
varchar
20
expire_date
date
expire_date_text
varchar
20
received_in_date
date
Yes
Description
DEFAULT CURRENT_DATE
received_in_at
timestamptz
Yes
Description
DEFAULT CURRENT_DATE
received_in_by_user_id
bigserial
Yes
last_modified
timestamptz
last_modified_user_id
bigserial
Yes
quantity
integer
Yes
lot_hold
boolean
Yes
Description
DEFAULT FALSE
search_vector
tsvector
Keys
Inventory***_pkey
Column in Inventory***_pkey
inventory_id
Inventory***_key
Column in Inventory***_key
lot_number
Name
Product***
Description
An idea with this is to be able to build a spec sheet if need be for web app customers instead of doing them by hand. A template will need to be made.
Columns
Name
Data type
Param
Key
Not Null
product_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer
bigserial
Yes
product_sku
varchar
40
Description
This is an internal product id. We have a shortened version for our pricelist program, others use UPC codes, etc.
quickbooks_product_id
integer
product_size
varchar
product_family
varchar
Yes
product_short_description
varchar
Yes
Description
This is what will be on the header of the pricelist sections. Probably having an example for reference like a photo would be helpful.
product_full_description
varchar
Description
This field will be used in invoicing customers. Similar to qbs.
pack_size
varchar
product_origin_id
integer
3
Yes
upc_outer
varchar
upc_inner
varchar
partials_per_case
integer
Yes
case_net_weight
integer
Yes
case_gross_weight
integer
Yes
product_utm_id
varchar
4
Yes
Description
bill by and unit of measure?? keep or get rid of?
bill_by
integer
2
Yes
Description
might need to make a separate table for this and use integers as IDs - ???
catch_method
integer
Yes
latin_name
varchar
FAO
varchar
Zone
varchar
special_import_requirements
varchar
dimensions
varchar
average_lead_time
integer
Description
how many days (divide by 7 to get weeks) are needed to produce the order
reorder_threshold
integer
Description
set what is deemed "re-order threshold" so it sends an alert to an admin or manager or "buyer"
reorder_alert
integer
Description
expressed in days (weeks is divide by 7)
low_inventory_alert
integer
Description
set what is deemed "low inventory" so it sends an alert to an admin or manager or "buyer"
special_import_requirements
varchar
sell_season_start1
integer
sell_season_end1
integer
sell_season_start2
integer
sell_season_end2
integer
sell_season_holiday
varchar
sell_season_weather1
varchar
sell_season_weather2
varchar
sell_season_weather3
varchar
sell_season_weather4
varchar
upc_outercase
varchar
upc_innercase
varchar
dimensions
varchar
product_spec_sheet1
text
product_spec_sheet2
text
product_spec_sheet3
text
product_spec_sheet4
text
product_spec_sheet5
text
cooking_instructions1
text
cooking_instructions2
text
Country_country_name
varchar
50
Yes
harvest_season_id
serial
product_photo_id
uuid
is_deleted
boolean
Description
DEFAULT FALSE This allows us to hide/archive for auditing purposes in the future or be able to restore a product in the future
product_document_id
bigserial
chart_of_accounts_type
bigserial
Yes
created_at
timestamptz
Yes
created_by_user_id
bigserial
Yes
last_modified
timestamptz
Yes
last_modified_user_id
bigserial
Yes
Keys
Product***_pkey
Column in Product***_pkey
product_id
Products***_key
Column in Products***_key
web_app_customer
Product***_key
Column in Product***_key
web_app_customer
Product***_key1
Column in Product***_key1
web_app_customer
Product***_key2
Column in Product***_key2
product_utm_id
Product***_key3
Column in Product***_key3
product_photo_id
Product***_key4
Column in Product***_key4
harvest_season_id
Product***_key5
Column in Product***_key5
product_document_id
Name
Catch_method
Columns
Name
Data type
Param
Key
Not Null
catch_method_id
serial
Yes
Yes
web_app_customer_id
bigserial
Yes
catch_method_name
varchar
Yes
description
text
Keys
Catch_method_pkey
Column in Catch_method_pkey
catch_method_id
Name
Advanced_settings**
Description
will be a work in progress... Divvy up based off Inventory, CRM, etc...
Columns
Name
Data type
Param
Key
Not Null
advanced_settings_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
set_po_number_global
varchar
set_po_number_prefix
boolean
Yes
po_number_prefix_per_user
boolean
quickbooks_integration_api
varchar
warehouse_starting_order_number
varchar
prefix_per_order_number_by_salesman
boolean
global_snooze_setting
varchar
Description
can take in "3 hours, 2 hours, 1 hour, 30 minutes, 15 minutes, 5 minutes"
Keys
Advanced_settings**_pkey
Column in Advanced_settings**_pkey
advanced_settings_id
Name
Company_global_settings**
Description
I think I need a global settings table to house customer settings. Advanced settings is for advanced settings that don't belong in standard settings like theme, langauage, time zone, ltr, etc. Global is the DEFAULT settings.
Columns
Name
Data type
Param
Key
Not Null
id
integer
Yes
Yes
Keys
Company_global_settings**_pkey
Column in Company_global_settings**_pkey
id
Name
User_settings**
Description
I do want settings for a per user basis. For example, some like a specific theme whereas some like darkmode. I want to be able to offer that to them. Not sure if languages would be for global for the customer or on a per user basis. The issue is how would it be a specific language? Like, global is English, but the user is Spanish. Would an admin or manager be able to add another language description to the product? More things to consider and think out!!
Columns
Name
Data type
Param
Key
Not Null
user_settings_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
salesman_prefix_to_order_number
varchar
6
allow_sales_popcards
boolean
Keys
User_settings**_pkey
Column in User_settings**_pkey
user_settings_id
Name
Bill_by** (aka "Sell By")
Description
More in-depth thinking needs to figure what this is for specifically! would we need UTM???
Columns
Name
Data type
Param
Key
Not Null
bill_by_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
bill_by_name
varchar
Yes
description
text
Keys
Bill_by** (aka "Sell By")_pkey
Column in Bill_by** (aka "Sell By")_pkey
bill_by_id
Name
Purchase Order Details
Columns
Name
Data type
Param
Key
Not Null
purchase_order_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer
bigserial
Yes
vendor_id
bigserial
Yes
pack_date
date
expiration_date
date
tlc_code
varchar
30
Description
"traceability lot code" - FDA Requirement 2026/27
purchase_order_items
bigserial
purchase_order_type
serial
Yes
Purchase_order_sent
timestamptz
Yes
created_at
timestamptz
Yes
created_by_user_id
bigserial
Yes
last_modified
timestamptz
Yes
last_modified_user_id
bigserial
Yes
total_value
integer
Yes
status
varchar
20
Yes
Description
DEFAULT "Pending"
Keys
Purchase Order Details_pkey
Column in Purchase Order Details_pkey
purchase_order_id
Purchase Order Details_key
Column in Purchase Order Details_key
web_app_customer
Purchase Order Details_key1
Column in Purchase Order Details_key1
purchase_order_items
Name
Vendors**
Description
**Need to figure out how to tie products to a specific vendor. Would it be divvy'd up with "vendor details" and "vendor products" I think the details are JOINed together with the Vendors table
Columns
Name
Data type
Param
Key
Not Null
vendor_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer
bigserial
Yes
vendor_name
varchar
41
Yes
vendor_dba
varchar
41
vendor_nickname
varchar
41
Description
Example, Rocky is Dalian Gourmet Foods. Or Ian is Dalian Zhengjun Foodstuff Search will index nicknames up to 3 letters at a minimum
preferred_vendor
boolean
vendor_type_id
serial
vendor_specialties
varchar
300
Yes
Description
Might be indexable for helping search for a vendor in the system that specializes in something you need. Like a trucker for an area or a vendor that sell a certain product.
plant_number
varchar
20
plant_code
varchar
20
fda_registration_number
varchar
20
china_registration_number
varchar
20
canadian_registration_number
varchar
20
eu_registration_number
varchar
20
registration_number
varchar
20
accounts_receivable_country_id
integer
3
accounts_receivable_zipcode
varchar
10
vendor_website
varchar
100
vendor_insured
boolean
vendor_insured_coverage_amount
varchar
paycargo
boolean
paycargo_website
varchar
300
vendor_login_username
varchar
100
vendor_login_password
varchar
100
Country_country_name
varchar
50
Yes
Vendor_type_vendor_type_name
varchar
30
Yes
vendor_product_id
bigserial
vendor_contact_id
serial
vendor_receivable_contact
serial
vendor_shipping_destination_id
serial
created_at
timestamptz
Yes
created_by_user_id
bigserial
Yes
last_modified
timestamptz
Yes
last_modified_user_id
bigserial
Yes
Keys
Vendors**_pkey
Column in Vendors**_pkey
vendor_id
Vendors**_key
Column in Vendors**_key
web_app_customer
Vendors**_key1
Column in Vendors**_key1
web_app_customer
Vendors**_key2
Column in Vendors**_key2
web_app_customer
Vendors**_key3
Column in Vendors**_key3
web_app_customer
Vendors**_key4
Column in Vendors**_key4
web_app_customer
Vendors**_key5
Column in Vendors**_key5
vendor_product_id
Vendors**_key6
Column in Vendors**_key6
vendor_contact_id
Vendors**_key7
Column in Vendors**_key7
vendor_receivable_contact
Vendors**_key8
Column in Vendors**_key8
vendor_shipping_destination_id
Name
Recalls** - NEED HELP
Description
This is for recalls. *Might need to add another table or more for all the things pertaining to one.
Columns
Name
Data type
Param
Key
Not Null
recall_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
recall_real_or_mock
boolean
Yes
inventory_product
uuid
Yes
Description
links to inventory_id
customer_orders
uuid
Yes
Description
links to order_id for all orders that pertain to this specific product in inventory (present, past)
Keys
Recalls** - NEED HELP_pkey
Column in Recalls** - NEED HELP_pkey
recall_id
Name
Order Line Items
Description
Considering it to be named "Order Products" This actually houses the items/products in the actual order. The Order table just houses the order details because customer_orders_id (changing to orders_id) has to be 1 number and it can't repeat. This is where multiple products can be added Same goes for Invoices... Same concept!
Columns
Name
Data type
Param
Key
Not Null
order_item_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
order_id
bigserial
Yes
inventory_product_id
bigserial
Yes
inventory_lot_number
varchar
Yes
product_quantity
numeric
10,2
Yes
clean_out
boolean
Description
????? Would it technically calculate it after? or would it have to have an ASYNC operation to arrive at this conclusion??
product_price
numeric
10, 2
price_is_delivered
boolean
pallets_total
numeric
10, 2
Yes
Keys
Order Line Items_pkey
Column in Order Line Items_pkey
order_item_id
Name
invoices
Description
**How to void??
Columns
Name
Data type
Param
Key
Not Null
invoice_id
bigserial
Yes
Yes
Keys
invoices_pkey
Column in invoices_pkey
invoice_id
Name
invoice_items
Description
follows the same rule as Orders and Order Items tables
Columns
Name
Data type
Param
Key
Not Null
invoice_item_id
bigserial
Yes
Yes
Keys
invoice_items_pkey
Column in invoice_items_pkey
invoice_item_id
Name
Global App Settings
Description
These are the main settings for the actual overall web app.
Columns
Name
Data type
Param
Key
Not Null
setting_id
serial
Yes
Yes
setting_name
varchar
100
Yes
Yes
Description
UNIQUE
setting_value
text
Yes
description_text
text
Yes
Keys
Global App Settings_pkey
Column in Global App Settings_pkey
setting_id
Column in Global App Settings_pkey
setting_name
Name
Popcards
Description
This is for helping salesmen sell when they might be on a call or selling something to someone or a prospect.
Columns
Name
Data type
Param
Key
Not Null
popcard_id
uuid
Yes
Yes
web_app_customer
uuid
Yes
popcard_name
varchar
Yes
popcard_value
varchar
Yes
Description
will need to elaborate on this. Need to figure out if I need to add more columns or whatnot.
Keys
Popcards_pkey
Column in Popcards_pkey
popcard_id
Name
Vendor_type
Columns
Name
Data type
Param
Key
Not Null
vendor_type_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
vendor_type_name
varchar
30
Yes
Yes
description
text
Keys
Vendor_type_pkey
Column in Vendor_type_pkey
vendor_type_id
Column in Vendor_type_pkey
vendor_type_name
Name
Country
Columns
Name
Data type
Param
Key
Not Null
country_id
integer
Yes
Yes
country_name
varchar
50
Yes
Yes
country_abreviation
varchar
3
Yes
Keys
Country_pkey
Column in Country_pkey
country_id
Column in Country_pkey
country_name
Name
Vendor_products
Columns
Name
Data type
Param
Key
Not Null
vendor_products_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
vendor_id
bigserial
Yes
vendor_products
bigserial
Keys
Vendor_products_pkey
Column in Vendor_products_pkey
vendor_products_id
Name
Purchase Order Line Items
Description
CHECK ( -- Ensure that either product_id or service_id is set, not both (product_id IS NOT NULL AND service_id IS NULL) OR (service_id IS NOT NULL AND product_id IS NULL) This makes sure that either or is NOT NULL. Might need to use "DECIMAL" as the data type.
Columns
Name
Data type
Param
Key
Not Null
purchase_order_item_id
bigserial
Yes
Yes
purchase_order_id
bigserial
Yes
web_app_customer_id
bigserial
Yes
product_id
bigserial
service_id
bigserial
quantity
numeric
10, 2
Yes
total_price
numeric
10, 2
Yes
unit_price
numeric
10, 2
Yes
vendor_id
bigserial
Yes
Keys
Purchase Order Line Items_pkey
Column in Purchase Order Line Items_pkey
purchase_order_item_id
Name
Session
Description
This stores sessions for all users. It only stores 1 session per user.
Columns
Name
Data type
Param
Key
Not Null
session_id
uuid
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
created_at
timestamptz
Description
DEFAULT NOW()
expires_at
timestamptz
Yes
ip_address
varchar
45
Yes
Description
store ip address
user_agent
text
Yes
mfa_verified
boolean
Yes
Description
DEFAULT FALSE
mfa_verified_at
timestamptz
Yes
Keys
Session_pkey
Column in Session_pkey
session_id
Session_key
Column in Session_key
user_id
Name
Session Activities
Description
This stores activities of the last 5 or 10(?) sessions of a user to help compare if there is any anomolies to trigger MFA (2-factor authentication).
Columns
Name
Data type
Param
Key
Not Null
session_id
uuid
Yes
Yes
user_id
bigserial
Yes
ip_address
varchar
45
Yes
user_agent
text
Yes
location
varchar
255
Yes
Description
geolocation
login_time
timestamptz
Yes
Description
DEFAULT NOW()
last_activity
timestamptz
Yes
Description
DEFAULT NOW()
Keys
Session Activities_pkey
Column in Session Activities_pkey
session_id
Name
Sub Accounts
Columns
Name
Data type
Param
Key
Not Null
user_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer_id
bigserial
Yes
username
varchar
255
Yes
Description
UNIQUE
password_hash
varchar
255
Yes
user_role
serial
Yes
email
varchar
100
Yes
Description
UNIQUE
cellphone
varchar
21
wechat
varchar
50
whatsapp
varchar
50
language_id
serial
Yes
Description
*defaults to the language on the device default language (ie: windows is english, then English it is). You can get this all from browser APIs.
created_at
timestamptz
Description
DEFAULT NOW()
is_deleted
boolean
Description
DEFAULT FALSE This allows us to restore a user if need be.
is_active
boolean
Description
DEFAULT TRUE
updated_at
timestamptz
Description
DEFAULT NOW()
disk_usage
bigint
Description
DEFAULT 0
is_anonymized
boolean
Yes
Description
DEFAULT FALSE
deleted_at
timestamptz
Keys
Sub Accounts_pkey
Column in Sub Accounts_pkey
user_id
Sub Accounts_key
Column in Sub Accounts_key
user_role
Sub Accounts_key1
Column in Sub Accounts_key1
external_id
Relations
Name
Parent
Child
Name
MFA Token
Columns
Name
Data type
Param
Key
Not Null
token_id
uuid
Yes
Yes
user_id
bigserial
Yes
token
varchar
6
Yes
expires_at
timestamptz
Yes
is_used
boolean
Yes
Description
DEFAULT FALSE
created_at
timestamptz
Yes
Description
DEFAULT NOW()
Keys
MFA Token_pkey
Column in MFA Token_pkey
token_id
Relations
Name
Backup Codes
Columns
Name
Data type
Param
Key
Not Null
code_id
uuid
Yes
Yes
user_id
bigserial
Yes
backup_code
varchar
12
Yes
is_used
boolean
Description
DEFAULT FALSE
Keys
Backup Codes_pkey
Column in Backup Codes_pkey
code_id
Name
User Role
Columns
Name
Data type
Param
Key
Not Null
user_id
bigserial
Yes
role_id
serial
Keys
User Role_pkey
Column in User Role_pkey
user_id
Name
Settings
Columns
Name
Data type
Param
Key
Not Null
setting_id
serial
Yes
Yes
setting_name
varchar
100
Yes
setting_value
text
Yes
Keys
Settings_pkey
Column in Settings_pkey
setting_id
Name
Role Settings
Description
Using Aproach 2 Conection Limit 5 (max by user_id or by IP). user_id might be best. But maybe 2 or 3 connections max. I would have to see if browser tabs open relate to this max connection. But, it might be based off browser id... Idk?
Columns
Name
Data type
Param
Key
Not Null
role_id
serial
Yes
Yes
setting_id
serial
Yes
Keys
Role Settings_pkey
Column in Role Settings_pkey
role_id
Name
User Specific Settings
Columns
Name
Data type
Param
Key
Not Null
user_id
uuid
Yes
Yes
setting_name
varchar
100
Yes
Yes
setting_value
text
100
Yes
Keys
User Specific Settings_pkey
Column in User Specific Settings_pkey
setting_name
Column in User Specific Settings_pkey
user_id
Name
Feature Specific Settings
Description
These are module specific settngs. IE: CRM, Inventory, Products Site, Accounting, etc...
Columns
Name
Data type
Param
Key
Not Null
feature_setting_id
serial
Yes
Yes
feature_name
varchar
100
Yes
Description
UNIQUE
setting_name
varchar
100
Yes
setting_value
text
Yes
description_text
text
Yes
Keys
Feature Specific Settings_pkey
Column in Feature Specific Settings_pkey
feature_setting_id
Name
System Settings
Description
Not sure if I need this. It seems to be a table used for admins for low-level settings. But, IDK...
Columns
Name
Data type
Param
Key
Not Null
setting_id
serial
Yes
Yes
setting_name
varchar
100
Yes
Description
UNIQUE
setting_value
text
Yes
sensitive
boolean
Yes
Description
DEFAULT FALSE -- Marks sensitive settings like API keys
description_text
text
Yes
Keys
System Settings_pkey
Column in System Settings_pkey
setting_id
Name
Customer Buyers
Description
This is for housing more than 1 buyer per customer. Keep adding details to it!
Columns
Name
Data type
Param
Key
Not Null
customer_buyer_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
Yes
buyer_position
varchar
50
buyer_firstname
varchar
50
Yes
buyer_lastname
varchar
50
buyer_email
varchar
100
buyer_phone
varchar
21
buyer_phone_ext
varchar
10
buyer_phone_direct
varchar
21
buyer_mobile
varchar
21
buyer_mobile_sms
boolean
buyer_wechat
varchar
50
buyer_whatsapp
varchar
50
is_deleted
boolean
Description
DEFAULT FALSE This allows the user to restore the contact in case they deleted them. Sort of like an "undo"
Keys
Customer Buyers_pkey
Column in Customer Buyers_pkey
customer_buyer_id
Column in Customer Buyers_pkey
web_app_customer
Name
Customer Delivery Addresses
Description
This is for housing more than 1 delivery address per customer
Columns
Name
Data type
Param
Key
Not Null
customer_delivery_address_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
Yes
delivery_label
varchar
40
delivery_attn
varchar
40
delivery_location_name
varchar
50
deliver_address1
varchar
60
Yes
delivery_address2
varchar
60
delivery_address_city
varchar
57
Yes
delivery_address_state
varchar
50
Yes
delivery_address_country_id
integer
3
Yes
delivery_address_zipcode
varchar
8
delivery_address_phone
varchar
21
Yes
delivery_address_email
varchar
100
delivery_address_file_location
text
Description
uploaded file
delivery_address_website
text
Keys
Customer Delivery Addresses_pkey
Column in Customer Delivery Addresses_pkey
customer_delivery_address_id
Column in Customer Delivery Addresses_pkey
web_app_customer
Name
Customer Accounting Contacts
Description
This is for housing more than accounant per customer
Columns
Name
Data type
Param
Key
Not Null
customer_accounting_contact_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
Yes
accounting_contact_name
varchar
50
accounting _contact_phone
varchar
21
accounting_contactphone_ext
varchar
10
accounting_contact_email
varchar
100
Keys
Customer Accounting Contacts_pkey
Column in Customer Accounting Contacts_pkey
web_app_customer
Column in Customer Accounting Contacts_pkey
customer_accounting_contact_id
Customer Accounting Contacts_key
Column in Customer Accounting Contacts_key
web_app_customer
Customer Accounting Contacts_key1
Column in Customer Accounting Contacts_key1
customer_accounting_contact_id
Name
Vendor Contacts
Description
Some of the fields like "created_at" and "last_modified" might be for internal or deeper things for insights in the future...
Columns
Name
Data type
Param
Key
Not Null
vendor_contact_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
vendor_contact_nickname
varchar
50
vendor_contact_firstname
varchar
50
vendor_contact_lastname
varchar
50
vendor_contact_phone
varchar
21
vendor_contact_phone_ext
varchar
10
vendor_contact_cellphone
varchar
21
vendor_contact_sms
boolean
vendor_contact_wechat
varchar
50
vendor_contact_whatsapp
varchar
50
vendor_contact_email
varchar
100
Yes
created_at
timestamptz
Yes
created_by_user_id
bigserial
Yes
last_modified
timestamptz
Yes
last_modified_user_id
bigserial
Yes
Description
key'd off when it is made initially and updated later
Keys
Vendor Contacts_pkey
Column in Vendor Contacts_pkey
vendor_contact_id
Name
Vendor Receivable Contacts
Columns
Name
Data type
Param
Key
Not Null
vendor_receivable_contact_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
vendor_receivable_firstname
varchar
50
vendor_receivable_lastname
varchar
50
vendor_recivable_phone
varchar
21
vendor_receivable_phone_ext
varchar
10
vendor_receivable_cellphone
varchar
21
vendor_receivable_email
varchar
100
vendor_receivable_fax
varchar
21
vendor_receivable_qq
varchar
50
vendor_receivable_wechat
varchar
50
vendor_receivable_whatsapp
varchar
50
created_at
timestamptz
Yes
created_by_user_id
bigserial
Yes
last_modified
timestamptz
Yes
last_modified_user_id
bigserial
Yes
Keys
Vendor Receivable Contacts_pkey
Column in Vendor Receivable Contacts_pkey
vendor_receivable_contact_id
Name
Vendor Shipping Destination
Columns
Name
Data type
Param
Key
Not Null
vendor_shipping destination_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
Yes
vendor_shipping_destination
varchar
100
Yes
Yes
Keys
Vendor Shipping Destination_pkey
Column in Vendor Shipping Destination_pkey
vendor_shipping destination_id
Column in Vendor Shipping Destination_pkey
vendor_shipping_destination
Column in Vendor Shipping Destination_pkey
web_app_customer
Name
Product Harvest Season
Columns
Name
Data type
Param
Key
Not Null
harvest_season_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
harvest_season_name
varchar
40
Yes
harvest_season_start
varchar
40
Yes
harvest_season_end
varchar
40
Yes
description
text
created_at
timestamptz
Keys
Product Harvest Season_pkey
Column in Product Harvest Season_pkey
harvest_season_id
Name
Product Photos
Description
**How to resize images to a specific size? Need to use Python app
Columns
Name
Data type
Param
Key
Not Null
product_picture_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
product_picture_filename
text
Yes
product_picture_filepath
text
Yes
product_photo_original_size
integer
product_photo_compressed_size
integer
product_photo_upload_date
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
Keys
Product Photos_pkey
Column in Product Photos_pkey
product_picture_id
Name
Product UTM
Description
Is the product sold by the lb, case, etc.?
Columns
Name
Data type
Param
Key
Not Null
product_utm_id
serial
Yes
Yes
product_utm_name
varchar
20
Yes
Yes
product_utm_abbv
varchar
4
Yes
Yes
description
text
Keys
Product UTM_pkey
Column in Product UTM_pkey
product_utm_id
Column in Product UTM_pkey
product_utm_name
Column in Product UTM_pkey
product_utm_abbv
Name
Warehouse Operation Days
Description
Logic will split the data up into separate areas for viewing. If days have the same "time" then only 1 will be shown and the 1st day of the week till the end will be. A potential issue is do I set Sunday-Saturday as the start of the week or Monday-Sunday??? Global standard might be it...
Columns
Name
Data type
Param
Key
Not Null
warehouse_operation_days_id
serial
Yes
Yes
web_app_customer_id
bigserial
Yes
Yes
operation_day_name
varchar
40
Yes
operation_day_shipping_start_hour
time
Yes
operation_day_shipping_end_hour
time
Yes
operation_day_receiving_start_hour
time
Yes
operation_day_receiving_end_hour
time
Yes
operation_day_orders_start_hour
time
Yes
operation_day_orders_end_hour
time
Yes
Keys
Warehouse Operation Days_pkey
Column in Warehouse Operation Days_pkey
warehouse_operation_days_id
Column in Warehouse Operation Days_pkey
web_app_customer_id
Name
Warehouse Contacts
Columns
Name
Data type
Param
Key
Not Null
warehouse_contact_id
serial
Yes
Yes
web_app_customer_id
bigserial
Yes
Yes
contact_type
serial
Yes
Yes
contact_phone
varchar
21
contact_phone_ext
varchar
10
contact_email
varchar
100
contact_cellphone
varchar
21
contact_sms
boolean
contact_fax
varchar
21
is_deleted
boolean
Description
DEFAULT FALSE This allows us to potentially restore a contact in case they were deleted
Keys
Warehouse Contacts_pkey
Column in Warehouse Contacts_pkey
warehouse_contact_id
Column in Warehouse Contacts_pkey
contact_type
Warehouse Contacts_key
Column in Warehouse Contacts_key
contact_type
Warehouse Contacts_key1
Column in Warehouse Contacts_key1
web_app_customer_id
Name
Warehouse Contact Type
Columns
Name
Data type
Param
Key
Not Null
warehouse_contact_type_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
Yes
contact_type_name
varchar
40
Yes
Yes
Description
customer sets the type (receiving, manager, gm, customer service, owner, etc.)
Keys
Warehouse Contact Type_pkey1
Column in Warehouse Contact Type_pkey1
warehouse_contact_type_id
Column in Warehouse Contact Type_pkey1
web_app_customer
Column in Warehouse Contact Type_pkey1
contact_type_name
Name
Customer Order Confirm Contact
Columns
Name
Data type
Param
Key
Not Null
customer_order_confirm_contact_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
Yes
order_confirm_contact_name
varchar
40
order_confirm_contact_email
varchar
Yes
Keys
Customer Order Confirm Contact_pkey
Column in Customer Order Confirm Contact_pkey
customer_order_confirm_contact_id
Column in Customer Order Confirm Contact_pkey
web_app_customer
Name
Reminders
Columns
Name
Data type
Param
Key
Not Null
reminders_id
bigserial
Yes
Yes
user_id
bigserial
Yes
web_app_customer_id
bigserial
Yes
reminder_title
varchar
255
Yes
reminder_description
text
reminder_time
timestamptz
Yes
is_recurring
boolean
Description
DEFAULT FALSE
rexurring_interval
varchar
50
Description
-- daily, weekly, monthly, etc.
reminder_created_at
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
is_deleted
boolean
Description
DEFAULT FALSE This is for auditing purposes so it is actually NOT deleted in the system. SMART!
Keys
Reminders_pkey
Column in Reminders_pkey
reminders_id
Name
Notifications
Columns
Name
Data type
Param
Key
Not Null
notifications_id
bigserial
Yes
Yes
reminders_id
bigserial
Yes
notification_time
timestamptz
Yes
notification_status
varchar
50
Description
DEFAULT 'pending', -- pending, sent, failed
Keys
Notifications_pkey
Column in Notifications_pkey
notifications_id
Name
Subscription Plans
Columns
Name
Data type
Param
Key
Not Null
subscription_plans_id
integer
Yes
Yes
subscription_plan_name
varchar
255
Yes
max_sub_accounts
integer
Yes
Description
-- Max number of sub-accounts allowed
subscription_price
money
Yes
Description
-- Monthly price
subscription_duration_in_days
integer
Yes
Description
-- Duration of subscription in days
subscription_start_date
timestamptz
Description
-- Start date of the subscription
subscription_end_date
timestamptz
Description
-- End date of the subscription
currency_id
serial
Description
EXAMPLE: INSERT INTO subscription_plans (name, max_sub_accounts, price, currency_id, duration_in_days) VALUES ('Basic Plan', 1, 10.00, 1, 30), -- USD ('Standard Plan', 5, 25.00, 1, 30), -- USD ('Premium Plan', 10, 30.00, 2, 30); -- Converted to EUR
features
text
Description
List what features it comes with.
Keys
Subscription Plans_pkey
Column in Subscription Plans_pkey
subscription_plans_id
Subscription Plans_key
Column in Subscription Plans_key
currency_id
Name
Currencies
Columns
Name
Data type
Param
Key
Not Null
currency_id
serial
Yes
Yes
currency_code
varchar
3
Description
UNIQUE -- ISO 4217 currency code (e.g., USD, EUR)
currency_symbol
varchar
10
Description
-- Currency symbol (e.g., $, €)
currency_exchange_rate
integer
10, 6
Yes
Description
*I'm hoping this acts like decimal. If not, change to "decimal" as the type in Postgresql. -- Exchange rate to a base currency (e.g., USD) EXAMPLE: INSERT INTO currencies (code, symbol, exchange_rate) VALUES ('USD', '$', 1.000000), -- Base currency ('EUR', '€', 0.850000), ('GBP', '£', 0.740000);
Keys
Currencies_pkey
Column in Currencies_pkey
currency_id
Name
Subscription Addons
Description
EXAMPLE: INSERT INTO subscription_addons (name, description, price, duration_in_days) VALUES ('50 GB Storage', 'Add 50 GB of storage to your plan.', 10.00, 30), ('100 GB Storage', 'Add 100 GB of storage to your plan.', 18.00, 30);
Columns
Name
Data type
Param
Key
Not Null
subscription_addons_id
serial
Yes
Yes
addon_name
varchar
255
Yes
Description
-- Name of the add-on (e.g., "50 GB Storage")
addon_description
text
Description
-- Description of the add-on
addon_price
money
Yes
Description
-- Price of the add-on per billing cycle
duration_in_days
integer
Yes
Description
-- Duration for which the add-on is valid (e.g., 30 days)
created_at
timestamptz
Description
DEFAULT NOW()
updated_at
timestamptz
Description
DEFAULT NOW()
Keys
Subscription Addons_pkey
Column in Subscription Addons_pkey
subscription_addons_id
Name
User Subscriptions
Columns
Name
Data type
Param
Key
Not Null
user_subscriptions_id
serial
Yes
Yes
customer_id
uuid
subscription_plan_id
integer
stripe_subscription_id
varchar
255
Yes
stripe_payment_intent_id
varchar
255
amount_paid
money
Yes
currency_id
serial
Yes
payment_status
varchar
50
Yes
Description
-- Payment status (e.g., succeeded, pending)
billing_start
timestamptz
Yes
Description
-- Start of billing cycle
billing_end
timestamptz
Yes
Description
-- End of billing cycle
created_at
timestamptz
Description
DEFAULT NOW() -- When the record was created
updated_at
timestamptz
Description
DEFAULT NOW() -- When the record was last updated
status
varchar
50
Description
DEFAULT 'active' -- e.g., 'active', 'cancelled', 'paused'
disk_quota
bigint
Yes
Keys
User Subscriptions_pkey
Column in User Subscriptions_pkey
user_subscriptions_id
Name
User Addons
Columns
Name
Data type
Param
Key
Not Null
user_addons_id
serial
Yes
Yes
user_subscription_id
serial
subscription_addon_id
serial
quantity
integer
Description
DEFAULT 1 -- Optional: Quantity of the add-on
created_at
timestamptz
Description
DEFAULT NOW()
updated_at
timestamptz
Description
DEFAULT NOW()
Keys
User Addons_pkey
Column in User Addons_pkey
user_addons_id
Name
Chart of Accounts
Columns
Name
Data type
Param
Key
Not Null
accounts_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer_id
bigserial
Yes
account_name
varchar
100
Yes
account_type
varchar
50
Yes
created_at
timestamptz
Yes
created_by_user_id
bigserial
Yes
last_modified
timestamptz
Yes
last_modified_user_id
bigserial
Yes
Keys
Chart of Accounts_pkey
Column in Chart of Accounts_pkey
accounts_id
Name
Order Statuses
Columns
Name
Data type
Param
Key
Not Null
order_status_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
status_name
varchar
255
Yes
status_description
text
is_active
boolean
Description
DEFAULT TRUE
created_at
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
Keys
Order Statuses_pkey
Name
Product Documents
Columns
Name
Data type
Param
Key
Not Null
product_document_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
product_document_filepath
varchar
255
Yes
product_document_filename
varchar
255
product_document_file_size
bigint
uploaded_at
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
Keys
Product Documents_pkey
Column in Product Documents_pkey
product_document_id
Name
Photos
Description
**How to resize images to a specific size? Need to use Python app
Columns
Name
Data type
Param
Key
Not Null
company_photo_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
company_photo_filename
text
Yes
company_photo_filepath
text
Yes
company_photo_original_size
integer
company_photo_compressed_size
integer
photo_file_ext
varchar
50
company_photo_upload_date
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
photo_type_id
serial
post_id
bigserial
Keys
Photos_pkey
Column in Photos_pkey
company_photo_id
Name
Documents
Columns
Name
Data type
Param
Key
Not Null
product_document_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
product_document_filepath
varchar
255
Yes
product_document_filename
varchar
255
product_document_file_size
bigint
uploaded_at
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
last_modified
timestamptz
post_id
bigserial
Keys
Documents_pkey
Column in Documents_pkey
product_document_id
Name
Photo Types
Description
Used for company internal things. Ex: Logo, trademarks, brands, etc. Sepcial photos...
Columns
Name
Data type
Param
Key
Not Null
photo_type_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
photo_type_name
varchar
255
Yes
description
text
created_at
timestamptz
last_modified
timestamptz
Keys
Photo Types_pkey
Column in Photo Types_pkey
photo_type_id
Name
Notes
Columns
Name
Data type
Param
Key
Not Null
note_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
user_id
bigserial
Yes
external_id
uuid
Yes
customer_id
bigserial
note_content
text
Yes
created_at
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
last_modified
timestamptz
reminder_at
timestamp
reminder_triggered
boolean
Description
DEFAULT FALSE
Keys
Notes_pkey
Column in Notes_pkey
note_id
Name
Blog Posts
Description
This is the equivalent of the Doc's Report on the Products Site.
Columns
Name
Data type
Param
Key
Not Null
post_id
bigserial
Yes
Yes
user_id
bigserial
Yes
web_app_customer
bigserial
Yes
external_id
uuid
Yes
title
varchar
255
Yes
content
text
Yes
created_at
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
updated_at
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
published
boolean
Description
DEFAULT FALSE
Keys
Blog Posts_pkey
Column in Blog Posts_pkey
post_id
Name
Comments*
Description
By default, this is OFF! This is in case we eventually open it up to external people. Better to have it setup then to not.
Columns
Name
Data type
Param
Key
Not Null
comment_id
bigserial
Yes
Yes
user_id
bigserial
customer_user_id
bigserial
web_app_customer
bigserial
Yes
post_id
bigserial
Yes
external_id
uuid
Yes
title
varchar
255
Yes
content
text
Yes
created_at
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
updated_at
timestamptz
Description
DEFAULT CURRENT_TIMESTAMPZ
published
boolean
Description
DEFAULT FALSE
Keys
Comments*_pkey
Column in Comments*_pkey
comment_id
Name
Customer Users*
Description
Purpose is for being able to either comment on blog posts or view pertinent information regarding their company. Example: Broker View, Outstanding invoices they haven't paid, statements, etc.
Columns
Name
Data type
Param
Key
Not Null
customer_user_id
bigserial
Yes
Yes
web_app_customer_id
bigserial
Yes
customer_role_id
serial
Yes
username
varchar
255
Yes
Description
UNIQUE
password_hash
varchar
255
Yes
email
varchar
100
Yes
Description
UNIQUE
cellphone
varchar
21
wechat
varchar
50
whatsapp
varchar
50
language_id
serial
Yes
Description
*defaults to the language on the device default language (ie: windows is english, then English it is). You can get this all from browser APIs.
created_at
timestamptz
Description
DEFAULT NOW()
is_deleted
boolean
Description
DEFAULT FALSE This allows us to restore a user if need be.
is_active
boolean
Description
DEFAULT TRUE
updated_at
timestamptz
Description
DEFAULT NOW()
Keys
Customer Users*_pkey
Column in Customer Users*_pkey
customer_user_id
Customer Users*_key
Customer Users*_key1
Column in Customer Users*_key1
customer_role_id
Name
Customer Roles
Description
You can name roles here. Need to figure out how it works
Columns
Name
Data type
Param
Key
Not Null
role_id
serial
Yes
Yes
role_name
varchar
30
Yes
role_permission
integer
Yes
Description
need to see how to give or add more permissions to a specific role.... Or if integer is the right value
Keys
Customer Roles_pkey
Column in Customer Roles_pkey
role_id
Name
Customer User Role
Description
Customers need logins, but they also need different roles. Such as: accounts payable, salesman, broker view, etc.
Columns
Name
Data type
Param
Key
Not Null
customer_user_id
bigserial
Yes
customer_role_id
serial
Keys
Customer User Role_pkey
Column in Customer User Role_pkey
customer_user_id
Name
Customer Settings
Columns
Name
Data type
Param
Key
Not Null
setting_id
serial
Yes
Yes
setting_name
varchar
100
Yes
setting_value
text
Yes
Keys
Customer Settings_pkey
Column in Customer Settings_pkey
setting_id
Name
Customer Role Settings
Description
Using Aproach 2
Columns
Name
Data type
Param
Key
Not Null
role_id
serial
Yes
Yes
setting_id
serial
Yes
Keys
Customer Role Settings_pkey
Column in Customer Role Settings_pkey
role_id
Name
Categories
Columns
Name
Data type
Param
Key
Not Null
category_id
serial
Yes
Yes
web_app_customer
bigserial
category_name
varchar
100
Yes
Description
UNIQUE
Keys
Categories_pkey
Column in Categories_pkey
category_id
Name
Post Categories
Columns
Name
Data type
Param
Key
Not Null
post_id
serial
Yes
Yes
category_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
Keys
Post Categories_pkey
Column in Post Categories_pkey
post_id
Column in Post Categories_pkey
category_id
Name
Tags
Columns
Name
Data type
Param
Key
Not Null
tags_id
serial
Yes
Yes
web_app_customer
bigserial
tags_name
varchar
100
Yes
Description
UNIQUE
Keys
Tags_pkey
Column in Tags_pkey
tags_id
Name
Post Tags
Columns
Name
Data type
Param
Key
Not Null
post_id
serial
Yes
Yes
tag_id
serial
Yes
Yes
web_app_customer
bigserial
Yes
Keys
Post Tags_pkey
Column in Post Tags_pkey
post_id
Column in Post Tags_pkey
tag_id
Name
Likes
Columns
Name
Data type
Param
Key
Not Null
likes_id
bigserial
Yes
Yes
web_app_customer
bigserial
Yes
post_id
serial
Yes
Yes
user_id
bigserial
Yes
customer_user_id
bigserial
Yes
created_at
timestamptz
Description
DEFAULT CURRENT_TIMESTAMP
Keys
Likes_pkey
Column in Likes_pkey
likes_id
Column in Likes_pkey
post_id
Column in Likes_pkey
user_id
Column in Likes_pkey
customer_user_id
Name
Timezones
Columns
Name
Data type
Param
Key
Not Null
timezone_id
integer
Yes
Yes
timezone_name
varchar
100
Yes
Description
America/Los_Angeles
timezone_offset
varchar
6
Yes
Description
-08:00
timezone_translation
varchar
100
Yes
Description
Only do it when it is a foreign country in the specific spelling!
description
text
Description
(UTC-08:00) Pacific Time (US and Canada)
Keys
Timezones_pkey
Column in Timezones_pkey
timezone_id
Name
Storage Calculations
Description
Helping figure out storage calculations**
Columns
Name
Data type
Param
Key
Not Null
id
integer
Yes
Yes
Keys
Storage Calculations_pkey
Column in Storage Calculations_pkey
id
Name
Services***
Description
Need to EXPOUND on this!!! Can't receive it in, but bills can be associated with it. Need to research more!!!
Columns
Name
Data type
Param
Key
Not Null
service_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer
bigserial
Yes
quickbooks_service_id
integer
service_name
varchar
255
Yes
description
text
chart_of_accounts_type
bigserial
Yes
created_at
timestamptz
Yes
created_by_user_id
bigserial
Yes
last_modified
timestamptz
Yes
last_modified_user_id
bigserial
Yes
Keys
Services***_pkey
Column in Services***_pkey
service_id
Name
Product Receipts***
Description
This is for receiving in products to "Inventory" and then we push/copy the info over to Inventory.
Columns
Name
Data type
Param
Key
Not Null
product_receipt_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer
bigserial
Yes
received_in_at
timestamptz
Yes
received_in_by_user_id
bigserial
Yes
last_modified
timestamptz
Yes
last_modified_by_user_id
bigserial
Yes
Keys
Product Receipts***_pkey
Column in Product Receipts***_pkey
product_receipt_id
Name
Journal Entries
Columns
Name
Data type
Param
Key
Not Null
entry_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_app_customer_id
bigserial
Yes
transaction_date
timestamptz
Yes
Description
DEFAULT CURRENT_DATE
description
text
Keys
Journal Entries_pkey
Column in Journal Entries_pkey
entry_id
Name
Journal Entries Line Items
Description
Need to use DECIMAL
Columns
Name
Data type
Param
Key
Not Null
line_item_id
bigserial
Yes
Yes
entry_id
bigserial
Yes
web_app_customer_id
bigserial
Yes
account_id
bigserial
debit
numeric
10, 2
Description
DEFAULT 0
credit
numeric
10, 2
Description
DEFAULT 0
Keys
Journal Entries Line Items_pkey
Column in Journal Entries Line Items_pkey
line_item_id
Name
Emails
Columns
Name
Data type
Param
Key
Not Null
email_id
bigserial
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
recipient
text
Yes
subject
text
Yes
body
text
Yes
sent_at
timestamptz
Yes
reply_token
uuid
Yes
Description
UNIQUE
status
text
Yes
is_html
boolean
Description
(Optional) Indicates if the body is HTML.
Keys
Emails_pkey
Column in Emails_pkey
email_id
Name
Emails Replies
Columns
Name
Data type
Param
Key
Not Null
email_reply_id
bigserial
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
email_id
bigserial
Yes
reply_body
text
Yes
received_at
timestamptz
Yes
is_html
boolean
Description
(Optional) Indicates if the body is HTML.
Keys
Emails Replies_pkey
Column in Emails Replies_pkey
email_reply_id
Name
Email Accounts
Description
This is for storing the actual email credentials for each web app customer's sub account. Reason why for an individual is that some salesman might be using their own gmail account logins to send emails or own web server sending IMAP settings.
Columns
Name
Data type
Param
Key
Not Null
email_accounts_id
bigserial
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
email_address
text
Yes
Description
UNIQUE
imap_server
text
Yes
imap_port
integer
Yes
Description
IMAP server port (e.g., 993 for SSL).
smtp_server
text
Yes
smtp_port
integer
Yes
Description
SMTP server port (e.g., 465 for SSL).
username
text
Yes
Description
Username for email authentication. Usually it is an email address.
password
text
Yes
Description
Password for email authentication. ENCRYPTED
created_at
timestamptz
Yes
updated_at
timestamptz
Yes
Keys
Email Accounts_pkey
Column in Email Accounts_pkey
email_accounts_id
Name
Custom Order Instructions
Description
Used for setting up Customer Defaults
Columns
Name
Data type
Param
Key
Not Null
custom_order_instructions_id
bigserial
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
customer_id
bigserial
Yes
warehouse_id
bigserial
Yes
instructions_text
text
Yes
Keys
Custom Order Instructions_pkey
Column in Custom Order Instructions_pkey
custom_order_instructions_id
Name
Action Logs
Description
This is for logging actions for all users. Early on this is crucial. But later on, it will become a pain point. Being able to offload this to some other database might be ideal. This will help keep the database running quickly.
Columns
Name
Data type
Param
Key
Not Null
action_log_id
bigserial
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
action
varchar
255
Yes
details
jsonb
Description
Optional: Store additional details in JSON format
created_at
timestamptz
Yes
Description
DEFAULT CURRENT_TIMESTAMP
Keys
Action Logs_pkey
Column in Action Logs_pkey
action_log_id
Name
files
Description
FOREIGN KEY (user_id) REFERENCES Sub Accounts (user_id) ON DELETE CASCADE
Columns
Name
Data type
Param
Key
Not Null
files_id
bigserial
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
file_name
varchar
255
Yes
file_size
bigint
Yes
file_path
text
Yes
created_at
timestamptz
Yes
Description
DEFAULT CURRENT_TIMESTAMP
modified_at
timestamptz
Keys
files_pkey
Column in files_pkey
files_id
Name
Shared Inventory
Columns
Name
Data type
Param
Key
Not Null
shared_intentory_id
bigserial
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
public_url
bigserial
Yes
created_at
timestamptz
Yes
Keys
Shared Inventory_pkey
Column in Shared Inventory_pkey
shared_intentory_id
Name
Shared Inventory Details
Description
This is able to pull in Inventory which allows you to pull in product details. This is why Relationships exist. To make it faster and have less space.
Columns
Name
Data type
Param
Key
Not Null
shared_intentory_details_id
bigserial
Yes
Yes
shared_inventory_id
bigserial
Yes
inventory_id
bigserial
Yes
product_details
varchar
255
Yes
Keys
Shared Inventory Details_pkey
Column in Shared Inventory Details_pkey
shared_intentory_details_id
Name
Data Processing Audit
Description
You need a table to track processing activities for personal data. This ensures transparency and records compliance. Use Case: Record every action involving personal data. For example: - File uploads or deletions. - Sub-account creation or deletion. - Changes to user details (e.g., email or username).
Columns
Name
Data type
Param
Key
Not Null
data_processing_audit_id
integer
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
action
varchar
255
Yes
processed_at
timestamptz
Yes
Description
DEFAULT CURRENT_TIMESTAMPZ
Keys
Data Processing Audit_pkey
Column in Data Processing Audit_pkey
data_processing_audit_id
Name
Data Deletion Logs
Description
To support the right to erasure (Article 17), log data deletions for accountability. Use Case: This table tracks when and why data was deleted, ensuring compliance with the "right to be forgotten."
Columns
Name
Data type
Param
Key
Not Null
data_deletion_log_id
integer
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
entity_type
varchar
50
Yes
Description
-- Type of entity (e.g., "file", "user", "sub_account")
entity_id
bigserial
Yes
Description
-- ID of the deleted entity
deletion_reason
text
Description
-- Reason for deletion (optional)
deleted_at
timestamptz
Yes
Description
DEFAULT CURRENT_TIMESTAMP
Keys
Data Deletion Logs_pkey
Column in Data Deletion Logs_pkey
data_deletion_log_id
Name
User Consents
Columns
Name
Data type
Param
Key
Not Null
user_consent_id
bigserial
Yes
Yes
web_app_customer_id
bigserial
Yes
user_id
bigserial
Yes
consent_type
varchar
255
Yes
Description
-- Type of consent (e.g., "data processing", "email marketing")
consent_given
boolean
Yes
Description
-- Whether consent is given or withdrawn
consented_at
timestamptz
Yes
Description
DEFAULT CURRENT_TIMESTAMPZ
Keys
User Consents_pkey
Column in User Consents_pkey
user_consent_id
Name
Purchase Order Vendors
Description
This table is to support the ability to do "split-POs". Meaning, havng 2 vendors on the same PO. This is usually an anomoly for us, but, it does happen. This ALSO allows me to convert a single vendor PO into a Split-PO. Pretty trick!
Columns
Name
Data type
Param
Key
Not Null
purchase_order_vendors_id
bigserial
Yes
Yes
purchase_order_id
bigserial
Yes
web_app_customer_id
bigserial
Yes
vendor_id
bigserial
Yes
vendor_amount
numeric
10, 2
Yes
status
varchar
20
Yes
Description
DEFAULT "Pending"
external_id
uuid
Yes
Keys
Purchase Order Vendors_pkey
Column in Purchase Order Vendors_pkey
purchase_order_vendors_id
Name
Inventory Revision Log
Columns
Name
Data type
Param
Key
Not Null
inventory_revision_log_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_customer_id
bigserial
Yes
inventory_id
bigserial
Yes
product_id
bigserial
Yes
old_lot_number
varchar
20
Yes
new_lot_number
varchar
20
Yes
quantity
integer
Yes
action
varchar
50
Yes
change_timestamp
timestamptz
Yes
Description
DEFAULT CURRENT_TIMESTAMPZ
change_by_user_id
bigserial
Yes
Keys
Inventory Revision Log_pkey
Column in Inventory Revision Log_pkey
inventory_revision_log_id
Name
Transfer Log
Columns
Name
Data type
Param
Key
Not Null
transfer_log_id
bigserial
Yes
Yes
external_id
uuid
Yes
web_customer_id
bigserial
Yes
from_warehouse_id
bigserial
Yes
to_warehouse_id
bigserial
Yes
old_lot_number
varchar
20
Yes
new_lot_number
varchar
20
Yes
quantity
integer
Yes
transfer_timestamp
timestamptz
Yes
Description
DEFAULT CURRENT_TIMESTAMPZ
transferred_by_user_id
bigserial
Yes
Keys
Transfer Log_pkey
Column in Transfer Log_pkey
transfer_log_id
relationships
Name
Order Details - COME BACK TO! NEED MORE WORK!_customer_id_fkey
Key and columns
Key name
Column in Customers
Column in Order Details - COME BACK TO! NEED MORE WORK!
Customers_pkey
customer_id
customer_id
Name
Customers_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Customers
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Order Details - COME BACK TO! NEED MORE _web_app_customer_fkey
Key and columns
Key name
Column in Web_App_Customer
Column in Order Details - COME BACK TO! NEED MORE WORK!
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Warehouse_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Warehouse
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Order Details - COME BACK TO! NEED MORE WORK_warehouse_id_fkey
Key and columns
Key name
Column in Warehouse
Column in Order Details - COME BACK TO! NEED MORE WORK!
Warehouse_pkey
warehouse_id
warehouse_id
Name
Order Details - COME BACK TO! NEED MORE WOR_order_type_id_fkey
Key and columns
Key name
Column in Order_Type
Column in Order Details - COME BACK TO! NEED MORE WORK!
Order_Type_pkey
order_type_id
order_type_id
Name
Customers_customer_type_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customer_Type
Column in Customers
Customer_Type_pkey
customer_type_id
customer_type_id
Name
Customer_Type_sellable_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sellable
Column in Customer_Type
Sellable_pkey
sellable_id
sellable
Name
Customers_payment_terms_Payment_terms_web_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Payment_terms
Column in Customers
Payment_terms_pkey
payment_terms_id
payment_terms
web_customer_id
Payment_terms_web_customer_id
Name
Customers_payment_type_Payment_type_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Payment_type
Column in Customers
Payment_type_pkey
payment_type_id
payment_type
web_app_customer_id
Payment_type_web_app_customer_id
Name
Order Details - COME BACK TO! NEED MORE WORK!_ship_term_fkey
Key and columns
Key name
Column in Ship_terms
Column in Order Details - COME BACK TO! NEED MORE WORK!
Ship_terms_pkey
ship_terms_id
ship_term
Name
Order Details - COME BACK TO! NEED M_inventory_product_id_fkey
Key and columns
Key name
Column in Product***
Column in Order Details - COME BACK TO! NEED MORE WORK!
Product***_pkey
product_id
inventory_product_id
Name
Inventory***_warehouse_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Warehouse
Column in Inventory***
Warehouse_pkey
warehouse_id
warehouse_id
Name
Product***_catch_method_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Catch_method
Column in Product***
Catch_method_pkey
catch_method_id
catch_method
Name
Advanced_settings**_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Advanced_settings**
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Product***_bill_by_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Bill_by** (aka "Sell By")
Column in Product***
Bill_by** (aka "Sell By")_pkey
bill_by_id
bill_by
Name
Inventory***_product_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Product***
Column in Inventory***
Product***_pkey
product_id
product_id
Name
Inventory***_purchase_order_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Purchase Order Details
Column in Inventory***
Purchase Order Details_pkey
purchase_order_id
purchase_order_id
Name
Purchase Order Details_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Purchase Order Details
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Vendors**_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Vendors**
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Product***_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Product***
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Recalls** - NEED HELP_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Recalls** - NEED HELP
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Recalls** - NEED HELP_inventory_product_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Inventory***
Column in Recalls** - NEED HELP
Inventory***_pkey
inventory_id
inventory_product
Name
Recalls** - NEED HELP_customer_orders_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Order Details - COME BACK TO! NEED MORE WORK!
Column in Recalls** - NEED HELP
customers_uuid
order_id
customer_orders
Name
Order Line Items_order_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Order Details - COME BACK TO! NEED MORE WORK!
Column in Order Line Items
customers_uuid
order_id
order_id
Name
Order Line Items_inventory_lot_number_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Inventory***
Column in Order Line Items
Inventory***_key
lot_number
inventory_lot_number
Name
Order Line Items_inventory_product_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Inventory***
Column in Order Line Items
Inventory***_pkey
inventory_id
inventory_product_id
Name
User_settings**_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in User_settings**
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Vendors**_vendor_type_id_Vendor_type_vendor_type_name_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendor_type
Column in Vendors**
Vendor_type_pkey
vendor_type_id
vendor_type_id
vendor_type_name
Vendor_type_vendor_type_name
Name
Product***_product_origin_id_Country_country_name_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Country
Column in Product***
Country_pkey
country_id
product_origin_id
country_name
Country_country_name
Name
Customers_country_id_Country_country_name_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Country
Column in Customers
Country_pkey
country_id
country_id
country_name
Country_country_name
Name
Warehouse_country_Country_country_name_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Country
Column in Warehouse
Country_pkey
country_id
country
country_name
Country_country_name
Name
Warehouse_billing_address_country_Country_country_name_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Country
Column in Warehouse
Country_pkey
country_id
billing_address_country
country_name
Country_country_name
Name
Vendor_products_vendor_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Vendor_products
Vendors**_pkey
vendor_id
vendor_id
Name
Vendor_products_vendor_products_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Product***
Column in Vendor_products
Product***_pkey
product_id
vendor_products
Name
Order Details - COME BACK TO! NEED MORE WORK!_trucker_id_fkey
Key and columns
Key name
Column in Vendors**
Column in Order Details - COME BACK TO! NEED MORE WORK!
Vendors**_pkey
vendor_id
trucker_id
Name
Inventory***_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Product***
Column in Inventory***
Products***_key
web_app_customer
web_app_customer
Name
Vendor_products_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Vendor_products
Vendors**_key
web_app_customer
web_app_customer
Name
Purchase Order Details_vendor_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Purchase Order Details
Vendors**_pkey
vendor_id
vendor_id
Name
Purchase Order Line Items_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Purchase Order Details
Column in Purchase Order Line Items
Purchase Order Details_key
web_app_customer
web_app_customer_id
Name
Purchase Order Line Items_purchase_order_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Purchase Order Details
Column in Purchase Order Line Items
Purchase Order Details_pkey
purchase_order_id
purchase_order_id
Name
Purchase Order Line Items_product_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Product***
Column in Purchase Order Line Items
Product***_pkey
product_id
product_id
Name
Purchase Order Line Items_purchase_order_item_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Purchase Order Details
Column in Purchase Order Line Items
Purchase Order Details_key1
purchase_order_items
purchase_order_item_id
Name
Web_App_Customer_language_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Languages
Column in Web_App_Customer
Languages_pkey1
languages_id
language_id
Name
Session Activities_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Session
Column in Session Activities
Session_key
user_id
user_id
Name
Session Activities_session_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Session
Column in Session Activities
Session_pkey
session_id
session_id
Name
MFA Token_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Session
Column in MFA Token
Session_key
user_id
user_id
Name
Backup Codes_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Backup Codes
Sub Accounts_pkey
user_id
user_id
Name
User Role_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in User Role
Sub Accounts_pkey
user_id
user_id
Name
User Role_role_id_fkey
Description
says to do MANY to MANY relations
Name
Source
Target
Cardinality type:
Many to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Roles
Column in User Role
Roles_pkey
role_id
role_id
Name
Role Settings_role_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Roles
Column in Role Settings
Roles_pkey
role_id
role_id
Name
Role Settings_setting_id_fkey
Description
MANY TO MANY relation
Name
Source
Target
Cardinality type:
Many to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Settings
Column in Role Settings
Settings_pkey
setting_id
setting_id
Name
Sub Accounts_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Sub Accounts
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Sub Accounts_language_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Languages
Column in Sub Accounts
Languages_pkey1
languages_id
language_id
Name
User Specific Settings_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in User Specific Settings
Sub Accounts_pkey
user_id
user_id
Name
Customer Buyers_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customers
Column in Customer Buyers
Customers_key1
web_app_customer
web_app_customer
Name
Customer Delivery Addresses_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customers
Column in Customer Delivery Addresses
Customers_key2
web_app_customer
web_app_customer
Name
Customer Accounting Contacts_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customers
Column in Customer Accounting Contacts
Customers_key3
web_app_customer
web_app_customer
Name
Vendor Contacts_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Vendor Contacts
Vendors**_key1
web_app_customer
web_app_customer
Name
Vendor Receivable Contacts_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Vendor Receivable Contacts
Vendors**_key3
web_app_customer
web_app_customer
Name
Vendors**_accounts_receivable_country_id_Country_country_n_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Country
Column in Vendors**
Country_pkey
country_id
accounts_receivable_country_id
country_name
Country_country_name
Name
Vendor Shipping Destination_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Vendor Shipping Destination
Vendors**_key4
web_app_customer
web_app_customer
Name
Product Harvest Season_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Product***
Column in Product Harvest Season
Product***_key
web_app_customer
web_app_customer
Name
Product UTM_product_utm_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Product***
Column in Product UTM
Product***_key2
product_utm_id
product_utm_id
Name
Product Photos_product_picture_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Product***
Column in Product Photos
Product***_key3
product_photo_id
product_picture_id
Name
Product Harvest Season_harvest_season_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Product***
Column in Product Harvest Season
Product***_key4
harvest_season_id
harvest_season_id
Name
Vendor_products_vendor_products_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Vendor_products
Vendors**_key5
vendor_product_id
vendor_products_id
Name
Vendor Contacts_vendor_contact_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Vendor Contacts
Vendors**_key6
vendor_contact_id
vendor_contact_id
Name
Vendor Receivable Contacts_vendor_receivable_contact_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Vendor Receivable Contacts
Vendors**_key7
vendor_receivable_contact
vendor_receivable_contact_id
Name
Vendor Shipping Destination_vendor_shipping destination_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Vendor Shipping Destination
Vendors**_key8
vendor_shipping_destination_id
vendor_shipping destination_id
Name
Customer Buyers_customer_buyer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customers
Column in Customer Buyers
Customers_key4
buyer_id
customer_buyer_id
Name
Customer Delivery Addresses_customer_delivery_address_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customers
Column in Customer Delivery Addresses
Customers_key5
delivery_address
customer_delivery_address_id
Name
Customer Accounting Contacts_customer_accounting_contact_i_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customers
Column in Customer Accounting Contacts
Customers_key6
accounting_contact
customer_accounting_contact_id
Name
Warehouse Operation Days_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Warehouse
Column in Warehouse Operation Days
Warehouse_key2
web_app_customer
web_app_customer_id
Name
Warehouse Operation Days_warehouse_operation_days_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Warehouse
Column in Warehouse Operation Days
Warehouse_key3
operation_days
warehouse_operation_days_id
Name
Warehouse Contacts_warehouse_contact_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Warehouse
Column in Warehouse Contacts
Warehouse_key5
contact
warehouse_contact_id
Name
Warehouse Contact Type_warehouse_contact_type_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Warehouse Contacts
Column in Warehouse Contact Type
Warehouse Contacts_key
contact_type
warehouse_contact_type_id
Name
Warehouse Contact Type_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Warehouse Contacts
Column in Warehouse Contact Type
Warehouse Contacts_key1
web_app_customer_id
web_app_customer
Name
Warehouse Contacts_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Warehouse
Column in Warehouse Contacts
Warehouse_key6
web_app_customer
web_app_customer_id
Name
Customer Order Confirm Contact_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customer Accounting Contacts
Column in Customer Order Confirm Contact
Customer Accounting Contacts_key
web_app_customer
web_app_customer
Name
Customer Order Confirm Contac_customer_order_confirm_conta_fkey
Key and columns
Key name
Column in Customer Accounting Contacts
Column in Customer Order Confirm Contact
Customer Accounting Contacts_key1
customer_accounting_contact_id
customer_order_confirm_contact_id
Name
Reminders_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Reminders
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Notifications_reminders_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Reminders
Column in Notifications
Reminders_pkey
reminders_id
reminders_id
Name
User Role_role_id_fkey1
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in User Role
Sub Accounts_key
user_role
role_id
Name
Subscription Plans_subscription_plans_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Subscription Plans
Web_App_Customer_key
subscription_plan_id
subscription_plans_id
Name
Currencies_currency_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Subscription Plans
Column in Currencies
Subscription Plans_key
currency_id
currency_id
Name
User Subscriptions_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in User Subscriptions
Web_App_Customer_pkey
web_app_customer_id
customer_id
Name
User Subscriptions_currency_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Currencies
Column in User Subscriptions
Currencies_pkey
currency_id
currency_id
Name
User Addons_user_subscription_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in User Subscriptions
Column in User Addons
User Subscriptions_pkey
user_subscriptions_id
user_subscription_id
Name
User Addons_subscription_addon_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Subscription Addons
Column in User Addons
Subscription Addons_pkey
subscription_addons_id
subscription_addon_id
Name
User Subscriptions_subscription_plan_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Subscription Plans
Column in User Subscriptions
Subscription Plans_pkey
subscription_plans_id
subscription_plan_id
Name
Catch_method_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Catch_method
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Order_Type_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Order_Type
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Order Line Items_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Order Line Items
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Product Photos_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Product Photos
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Order Statuses_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Order Statuses
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Order Statuses_order_status_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Order Details - COME BACK TO! NEED MORE WORK!
Column in Order Statuses
Order Details - COME BACK TO! NEED MORE WORK!_key
order_status_id
order_status_id
Name
Photos_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Photos
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Product Documents_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Product Documents
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Photo Types_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Photo Types
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Photos_photo_type_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Photo Types
Column in Photos
Photo Types_pkey
photo_type_id
photo_type_id
Name
Documents_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Documents
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Product Documents_product_document_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Product***
Column in Product Documents
Product***_key5
product_document_id
product_document_id
Name
Ship_terms_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Ship_terms
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Notes_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Notes
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Notes_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Notes
Sub Accounts_pkey
user_id
user_id
Name
Notes_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customers
Column in Notes
Customers_pkey
customer_id
customer_id
Name
Blog Posts_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Blog Posts
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Blog Posts_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Blog Posts
Sub Accounts_pkey
user_id
user_id
Name
Comments*_post_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Blog Posts
Column in Comments*
Blog Posts_pkey
post_id
post_id
Name
Comments*_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Comments*
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Customer Users*_language_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Languages
Column in Customer Users*
Languages_pkey1
languages_id
language_id
Name
Customer User Role_customer_role_id_fkey
Description
says to do MANY to MANY relations
Name
Source
Target
Cardinality type:
Many to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customer Roles
Column in Customer User Role
Customer Roles_pkey
role_id
customer_role_id
Name
Customer Role Settings_role_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customer Roles
Column in Customer Role Settings
Customer Roles_pkey
role_id
role_id
Name
Customer Role Settings_setting_id_fkey
Description
MANY TO MANY relation
Name
Source
Target
Cardinality type:
Many to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customer Settings
Column in Customer Role Settings
Customer Settings_pkey
setting_id
setting_id
Name
Customer User Role_customer_role_id_fkey1
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customer Users*
Column in Customer User Role
Customer Users*_key1
customer_role_id
customer_role_id
Name
Customer User Role_customer_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customer Users*
Column in Customer User Role
Customer Users*_pkey
customer_user_id
customer_user_id
Name
Customer Users*_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Customer Users*
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Comments*_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Comments*
Sub Accounts_pkey
user_id
user_id
Name
Comments*_customer_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customer Users*
Column in Comments*
Customer Users*_pkey
customer_user_id
customer_user_id
Name
Categories_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Categories
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Post Categories_post_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Blog Posts
Column in Post Categories
Blog Posts_pkey
post_id
post_id
Name
Post Categories_category_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Comments*
Column in Post Categories
Comments*_pkey
comment_id
category_id
Name
Post Categories_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Post Categories
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Tags_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Tags
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Post Tags_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Post Tags
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Post Tags_post_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Blog Posts
Column in Post Tags
Blog Posts_pkey
post_id
post_id
Name
Post Tags_tag_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Tags
Column in Post Tags
Tags_pkey
tags_id
tag_id
Name
Likes_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Likes
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Likes_post_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Blog Posts
Column in Likes
Blog Posts_pkey
post_id
post_id
Name
Likes_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Likes
Sub Accounts_pkey
user_id
user_id
Name
Likes_customer_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customer Users*
Column in Likes
Customer Users*_pkey
customer_user_id
customer_user_id
Name
Photos_post_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Blog Posts
Column in Photos
Blog Posts_pkey
post_id
post_id
Name
Documents_post_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Blog Posts
Column in Documents
Blog Posts_pkey
post_id
post_id
Name
Customers_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Customers
Sub Accounts_pkey
user_id
user_id
Name
Services***_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Services***
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Purchase Order Line Items_service_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Services***
Column in Purchase Order Line Items
Services***_pkey
service_id
service_id
Name
Chart of Accounts_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Chart of Accounts
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Journal Entries Line Items_entry_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Journal Entries
Column in Journal Entries Line Items
Journal Entries_pkey
entry_id
entry_id
Name
Journal Entries Line Items_account_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Chart of Accounts
Column in Journal Entries Line Items
Chart of Accounts_pkey
accounts_id
account_id
Name
Product Receipts***_web_app_customer_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Product Receipts***
Web_App_Customer_pkey
web_app_customer_id
web_app_customer
Name
Order Details - COME BACK TO! NEED MORE WORK!_user_id_fkey
Key and columns
Key name
Column in Sub Accounts
Column in Order Details - COME BACK TO! NEED MORE WORK!
Sub Accounts_pkey
user_id
user_id
Name
Order Details - COME BACK TO! NEED MORE _last_modified_by_fkey
Key and columns
Key name
Column in Sub Accounts
Column in Order Details - COME BACK TO! NEED MORE WORK!
Sub Accounts_pkey
user_id
last_modified_by
Name
Product***_chart_of_accounts_type_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Chart of Accounts
Column in Product***
Chart of Accounts_pkey
accounts_id
chart_of_accounts_type
Name
Services***_chart_of_accounts_type_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Chart of Accounts
Column in Services***
Chart of Accounts_pkey
accounts_id
chart_of_accounts_type
Name
Vendor Receivable Contacts_last_modified_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Vendor Receivable Contacts
Sub Accounts_pkey
user_id
last_modified_user_id
Name
Vendor Contacts_last_modified_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Vendor Contacts
Sub Accounts_pkey
user_id
last_modified_user_id
Name
Inventory***_last_modified_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Inventory***
Sub Accounts_pkey
user_id
last_modified_user_id
Name
Chart of Accounts_last_modified_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Chart of Accounts
Sub Accounts_pkey
user_id
last_modified_user_id
Name
Vendors**_last_modified_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Vendors**
Sub Accounts_pkey
user_id
last_modified_user_id
Name
Services***_last_modified_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Services***
Sub Accounts_pkey
user_id
last_modified_user_id
Name
Purchase Order Details_last_modified_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Purchase Order Details
Sub Accounts_pkey
user_id
last_modified_user_id
Name
Product***_last_modified_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Product***
Sub Accounts_pkey
user_id
last_modified_user_id
Name
Product***_created_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Product***
Sub Accounts_pkey
user_id
created_by_user_id
Name
Purchase Order Details_created_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Purchase Order Details
Sub Accounts_pkey
user_id
created_by_user_id
Name
Services***_created_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Services***
Sub Accounts_pkey
user_id
created_by_user_id
Name
Vendors**_created_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Vendors**
Sub Accounts_pkey
user_id
created_by_user_id
Name
Vendor Contacts_created_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Vendor Contacts
Sub Accounts_pkey
user_id
created_by_user_id
Name
Vendor Receivable Contacts_created_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Vendor Receivable Contacts
Sub Accounts_pkey
user_id
created_by_user_id
Name
Chart of Accounts_created_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Chart of Accounts
Sub Accounts_pkey
user_id
created_by_user_id
Name
Inventory***_received_in_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Inventory***
Sub Accounts_pkey
user_id
received_in_by_user_id
Name
Product Receipts***_received_in_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Product Receipts***
Sub Accounts_pkey
user_id
received_in_by_user_id
Name
Product Receipts***_last_modified_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Product Receipts***
Sub Accounts_pkey
user_id
last_modified_by_user_id
Name
Reminders_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Reminders
Sub Accounts_pkey
user_id
user_id
Name
Emails Replies_email_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Emails
Column in Emails Replies
Emails_pkey
email_id
email_id
Name
Emails_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Emails
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Emails Replies_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Emails Replies
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Emails_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Emails
Sub Accounts_pkey
user_id
user_id
Name
Emails Replies_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Emails Replies
Sub Accounts_pkey
user_id
user_id
Name
Email Accounts_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Email Accounts
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Email Accounts_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Email Accounts
Sub Accounts_key1
external_id
user_id
Name
Custom Order Instructions_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Custom Order Instructions
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Custom Order Instructions_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Custom Order Instructions
Sub Accounts_pkey
user_id
user_id
Name
Custom Order Instructions_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Customers
Column in Custom Order Instructions
Customers_pkey
customer_id
customer_id
Name
Custom Order Instructions_warehouse_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Warehouse
Column in Custom Order Instructions
Warehouse_pkey
warehouse_id
warehouse_id
Name
Action Logs_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Action Logs
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Action Logs_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Action Logs
Sub Accounts_pkey
user_id
user_id
Name
files_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in files
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
files_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in files
Sub Accounts_pkey
user_id
user_id
Name
Shared Inventory Details_inventory_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Inventory***
Column in Shared Inventory Details
Inventory***_pkey
inventory_id
inventory_id
Name
Shared Inventory Details_shared_inventory_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Shared Inventory
Column in Shared Inventory Details
Shared Inventory_pkey
shared_intentory_id
shared_inventory_id
Name
Data Processing Audit_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Data Processing Audit
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Data Deletion Logs_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Data Deletion Logs
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Data Processing Audit_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Data Processing Audit
Sub Accounts_pkey
user_id
user_id
Name
Data Deletion Logs_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Data Deletion Logs
Sub Accounts_pkey
user_id
user_id
Name
User Consents_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in User Consents
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
User Consents_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in User Consents
Sub Accounts_pkey
user_id
user_id
Name
Session_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Session
Sub Accounts_pkey
user_id
user_id
Name
Session_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Session
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Purchase Order Line Items_vendor_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Purchase Order Line Items
Vendors**_pkey
vendor_id
vendor_id
Name
Purchase Order Vendors_purchase_order_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Purchase Order Details
Column in Purchase Order Vendors
Purchase Order Details_pkey
purchase_order_id
purchase_order_id
Name
Purchase Order Vendors_web_app_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Purchase Order Vendors
Web_App_Customer_pkey
web_app_customer_id
web_app_customer_id
Name
Purchase Order Vendors_vendor_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Vendors**
Column in Purchase Order Vendors
Vendors**_pkey
vendor_id
vendor_id
Name
Inventory Revision Log_change_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Inventory Revision Log
Sub Accounts_pkey
user_id
change_by_user_id
Name
Inventory Revision Log_product_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Product***
Column in Inventory Revision Log
Product***_pkey
product_id
product_id
Name
Inventory Revision Log_inventory_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Inventory***
Column in Inventory Revision Log
Inventory***_pkey
inventory_id
inventory_id
Name
Transfer Log_transferred_by_user_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Sub Accounts
Column in Transfer Log
Sub Accounts_pkey
user_id
transferred_by_user_id
Name
Transfer Log_web_customer_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Web_App_Customer
Column in Transfer Log
Web_App_Customer_pkey
web_app_customer_id
web_customer_id
Name
Transfer Log_from_warehouse_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Warehouse
Column in Transfer Log
Warehouse_pkey
warehouse_id
from_warehouse_id
Name
Transfer Log_to_warehouse_id_fkey
Name
Source
Target
Cardinality type:
One to
many
Ordinality:
Mandatory
Mandatory
Key and columns
Key name
Column in Warehouse
Column in Transfer Log
Warehouse_pkey
warehouse_id
to_warehouse_id
Notes
Name
Text1
Note

*Add Primary Keys,

They don't need a relation to them to be one!

Name
Text2
Note

*Will need to revise PKs and FKs

Name
Text3
Note

How to be able to offer multiple languages?

Name
Text4
Note

How to do double-entry

for inventory???

Name
Text5
Note

Double Entry Accounting

Name
Text6
Note

Add external_id to all tables.

Replace UUID for customer_id with bigserial


This is known as the "Hybrid Approach"

Name
Text7
Note

*Reminders need to use TIMESTAMP

They are in "local time". No sense utilizing TIMESTAMPZ.

Name
Text8
Note

*Scheduling stuff would be in TIMESTAMP as well

They are in "local time". No sense utilizing TIMESTAMPZ.

Name
Text9
Note

**Pricelist Sending TIMESTAMPZ

They traverse multiple times.

Name
Text10
Note

**Sending emails in the web app use TIMESTAMP

Local time is what is needed

Name
Text11
Note

Pricelist Portion

Name
Text12
Note

Add: ^^^^^

user_id for any table; and for any table that has "last_modified" & "created_at" in it. This is used to track changes made by users and any potential for users to "self sabotage a company" and who maybe did an order.