Table stoq_schema.public.sale Generated by
SchemaSpy
Legend: SourceForge.net
Primary key columns
Columns with indexes
Implied relationships
Excluded column relationships
< n > number of related tables
 
Column Type Size Nulls Auto Default Children Parents Comments
id uuid 2147483647 uuid_generate_v1()
commission.sale_id commission_sale_id_fkey R
fiscal_sale_history.sale_id fiscal_sale_history_sale_id_fkey R
returned_sale.new_sale_id returned_sale_new_sale_id_fkey R
returned_sale.sale_id returned_sale_sale_id_fkey R
sale_comment.sale_id sale_comment_sale_id_fkey R
sale_item.sale_id sale_item_sale_id_fkey R
work_order.sale_id work_order_sale_id_fkey R
te_id int8 19  √  new_te()
transaction_entry.id sale_te_id_fkey R
identifier serial 10  √  nextval('sale_identifier_seq'::regclass)
coupon_id int4 10  √  null
invoice_number int4 10  √  null
service_invoice_number int4 10  √  null
status sale_status 2147483647
discount_value numeric 20,2  √  null
surcharge_value numeric 20,2  √  null
total_amount numeric 20,2  √  null
open_date timestamp 29,6  √  null
close_date timestamp 29,6  √  null
confirm_date timestamp 29,6  √  null
cancel_date timestamp 29,6  √  null
return_date timestamp 29,6  √  null
expire_date timestamp 29,6  √  null
operation_nature text 2147483647  √  null
client_id uuid 2147483647  √  null
client.id sale_client_id_fkey R
client_category_id uuid 2147483647  √  null
client_category.id sale_client_category_id_fkey R
cfop_id uuid 2147483647  √  null
cfop_data.id sale_cfop_id_fkey R
salesperson_id uuid 2147483647  √  null
sales_person.id sale_salesperson_id_fkey R
branch_id uuid 2147483647
branch.id sale_branch_id_fkey R
group_id uuid 2147483647  √  null
payment_group.id sale_group_id_fkey R
transporter_id uuid 2147483647  √  null
transporter.id sale_transporter_id_fkey R
cost_center_id uuid 2147483647  √  null
cost_center.id sale_cost_center_id_fkey R
paid bool 1  √  false
invoice_id uuid 2147483647  √  null
invoice.id sale_invoice_id_fkey R
sale_token_id uuid 2147483647  √  null
sale_token.id sale_sale_token_id_fkey R

Analyzed at Fri Jun 10 16:06 BRT 2016

Indexes:
Column(s) Type Sort Constraint Name Anomalies
id Primary key Asc sale_pkey  
identifier + branch_id Must be unique Asc/Asc sale_identifier_branch_id_key  
invoice_number + branch_id Must be unique Asc/Asc sale_invoice_number_branch_id_key  
te_id Must be unique Asc sale_te_id_key This unique column is also nullable

Close relationships  within of separation: