Columns
Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | |||
---|---|---|---|---|---|---|---|---|---|---|---|
tx_id | bpchar | 6 | √ | to_char(nextval('tx_id_seq'::regclass), 'TX-FM000'::text) |
|
|
|||||
date | date | 13 | CURRENT_DATE |
|
|
||||||
total | numeric | 0 | √ | null |
|
|
|||||
tax_rate | numeric | 0 | √ | null |
|
|
|||||
discount | numeric | 0 | √ | null |
|
|
|||||
method | bpchar | 4 | 'CARD'::bpchar |
|
|
||||||
shop_id | bpchar | 11 | √ | null |
|
|
|||||
notes | text | 2147483647 | √ | null |
|
|
Indexes
Constraint Name | Type | Sort | Column(s) |
---|---|---|---|
transactions_pkey | Primary key | Asc | tx_id |
Check Constraints
Constraint Name | Constraint |
---|---|
transactions_gift_check | ((((method = 'GIFT'::bpchar) AND (total IS NULL) AND (tax_rate IS NULL)) OR ((method <> 'GIFT'::bpchar) AND (tax_rate IS NOT NULL) AND (shop_id IS NOT NULL)))) |
transactions_method_check | ((method = ANY (ARRAY['CARD'::bpchar, 'CASH'::bpchar, 'GIFT'::bpchar]))) |
transactions_discount_check | ((discount > (0)::numeric)) |
transactions_tx_id_check | ((tx_id ~ '^TX-[0-9]{3}$'::text)) |
transactions_total_check | ((total >= (0)::numeric)) |
transactions_tax_rate_check | (((tax_rate >= (0)::numeric) AND (tax_rate <= (1)::numeric))) |