couponcodes
Individual coupon codes with redemption tracking.
| Name | Type | Nullable | Default Value | Notes |
|---|---|---|---|---|
PKID | bigint | Coupon code ID | ||
creator | integer | Creator user ID (defaults to authenticated user on creation) | ||
creationdate | bigint | date_part('epoch', now()) | Creation date and time as a Unix timestamp (defaults to current date and time on creation) | |
lastmodified | bigint | date_part('epoch', now()) | Last modification date and time as a Unix timestamp (auto-reset on modification) | |
coupon coupons.ID | integer | Coupon ID (**dependency**) | ||
transaction transactions.ID | integer | Transaction ID | ||
flag | smallint | 0 | Flag (`0`=BOOKED, `1`=RESERVED, `2`=CANCELLED) | |
date | bigint | date_part('epoch', now()) | Designated date and time as a Unix timestamp (defaults to current date and time on creation) | |
code | text | Coupon code | ||
value | double precision | 0 | Value | |
datefrom | bigint | Start date and time as a Unix timestamp; must be less than or equal to `dateto` | ||
dateto | bigint | End date and time as a Unix timestamp; must be greater than or equal to `datefrom` |
| Name | Unique | Nulls Distinct | Primary | Partial | Method | Keys |
|---|---|---|---|---|---|---|
| fk_couponcodes_coupon | gin | coupon | ||||
| fk_couponcodes_transaction | btree | transaction | ||||
| i_couponcodes_code | btree | code | ||||
| pk_couponcodes | btree | ID | ||||
| s_couponcodes_code | gin | code |
| Name | Type |
|---|---|
| c_couponcodes_date | check |
| dc_couponcodes_code | check |
| dc_couponcodes_flag | check |
| fk_couponcodes_coupon | foreign_key |
| fk_couponcodes_transaction | foreign_key |
| pk_couponcodes | primary_key |
| Name | Type | Events | Function | Definition |
|---|---|---|---|---|
| ti_couponcodes_unique | before | insert | ftiu_couponcodes_unique | |
| tu_couponcodes_unique | before | update | ftiu_couponcodes_unique |
Loading...