Entity coupon
Subject areas: Sales
Attributes
| # | Name | Type | Null | Default | Key | Terms | Description |
|---|---|---|---|---|---|---|---|
| 1 | id | bigint | no | PK | |||
| 2 | code | text(40) | no | UQ | |||
| 3 | percent_off | smallint | no | ||||
| 4 | valid_until | date | yes |
Keys
| Kind | Name | Attributes |
|---|---|---|
| primary | pk_coupon | id |
| unique | uq_coupon_code | code |
Relationships
| Name | Role | Other entity | Cardinality | Attributes | Identifying | On delete | On update |
|---|---|---|---|---|---|---|---|
| order_coupon | parent | order | zero_or_one to many | order.coupon_id -> coupon.id | no | set_null | no_action |
Physical
lite (sqlite): main.coupon
| # | Name | Type | Null | Default | Identity | Collation | Attribute | Comment |
|---|---|---|---|---|---|---|---|---|
| 1 | id | integer | no | by_default | id | |||
| 2 | code | text | no | code | ||||
| 3 | percent_off | integer | no | percent_off | ||||
| 4 | valid_until | text | yes | valid_until |
- primary key pk_coupon (id)
- unique uq_coupon_code (code)
pg (postgresql): public.coupon
| # | Name | Type | Null | Default | Identity | Collation | Attribute | Comment |
|---|---|---|---|---|---|---|---|---|
| 1 | id | bigint | no | always | id | |||
| 2 | code | varchar(40) | no | code | ||||
| 3 | percent_off | smallint | no | percent_off | ||||
| 4 | valid_until | date | yes | valid_until |
- primary key pk_coupon (id)
- unique uq_coupon_code (code)