Entity payment
Subject areas: Sales
Attributes
| # | Name | Type | Null | Default | Key | Terms | Description |
|---|---|---|---|---|---|---|---|
| 1 | id | bigint | no | PK | |||
| 2 | order_id | bigint | no | FK | |||
| 3 | reference_no | bigint | no | UQ | |||
| 4 | amount | domain money (decimal(12, 2)) | no | 0 | |||
| 5 | paid_at | timestamptz | no | expr "now()" |
Keys
| Kind | Name | Attributes |
|---|---|---|
| primary | pk_payment | id |
| unique | uq_payment_reference | reference_no |
Relationships
| Name | Role | Other entity | Cardinality | Attributes | Identifying | On delete | On update |
|---|---|---|---|---|---|---|---|
| payment_order | child | order | one to many | payment.order_id -> order.id | no | no_action | no_action |
Physical
lite (sqlite): main.payment
| # | Name | Type | Null | Default | Identity | Collation | Attribute | Comment |
|---|---|---|---|---|---|---|---|---|
| 1 | id | integer | no | by_default | id | |||
| 2 | order_id | integer | no | order_id | ||||
| 3 | reference_no | integer | no | reference_no | ||||
| 4 | amount | numeric | no | 0 | amount | |||
| 5 | paid_at | text | no | expr "CURRENT_TIMESTAMP" | paid_at |
- primary key pk_payment (id)
- unique uq_payment_reference (reference_no)
- foreign key fk_payment_order (order_id) references order (id)
- index ix_payment_order (order_id)
pg (postgresql): public.payment
| # | Name | Type | Null | Default | Identity | Collation | Attribute | Comment |
|---|---|---|---|---|---|---|---|---|
| 1 | id | bigint | no | always | id | |||
| 2 | order_id | bigint | no | order_id | ||||
| 3 | reference_no | bigint | no | expr "nextval('payment_reference_seq')" | reference_no | |||
| 4 | amount | numeric(12, 2) | no | 0 | amount | |||
| 5 | paid_at | timestamp with time zone | no | expr "now()" | paid_at |
- primary key pk_payment (id)
- unique uq_payment_reference (reference_no)
- foreign key fk_payment_order (order_id) references order (id)
- index ix_payment_order (order_id)