PX_COUPON

All of the coupons issued to individual customers.


Column Descriptions:

Name Type Description
PX_COUPON_ID BIGINT NOT NULL The primary key of a coupon. This is the coupon ID.
USERS_ID BIGINT Foreign key to the USERS table. The identified customer is the owner of this coupon, if the coupon is issued to a registered user.
STOREENT_ID INTEGER NOT NULL Foreign key to the STOREENT table. The store entity ID, plus the name, plus the version uniquely identify the promotion for which this coupon is issued.
VERSION INTEGER NOT NULL The version of the promotion for which this coupon is issued.
EFFECTIVE TIMESTAMP NOT NULL The date on which this coupon first becomes active.
EXPIRE TIMESTAMP NOT NULL The date when this coupon expires.
STATUS INTEGER NOT NULL DEFAULT 0 The current status of this coupon:
0: active
1: canceled
2: being used in an order but not finalized yet
3: expired
4: deleted

Default is 0.
ORDERS_ID BIGINT Foreign key to the ORDERS table. If this coupon is being used in an order, or applied to an order and canceled, this identifies the order.
GUESTID VARCHAR (64) This is the token by which this guest user will be recognized next time, if the coupon is issued to a guest user.
NAME VARCHAR (128) NOT NULL The name of the promotion for which this coupon is issued.
CODE VARCHAR (128) An optional code to identify this coupon.
OPTCOUNTER SMALLINT NOT NULL DEFAULT 0 The optimistic concurrency control counter for the table. Every time there is an update to the table, the counter is incremented.


Indexes:

Name Column Names Type
<SYSTEM-GENERATED> PX_COUPON_ID Primary Key
I0000389 STOREENT_ID+NAME+VERSION Non-Unique Index
I0000390 ORDERS_ID+USERS_ID Non-Unique Index
I0000391 ORDERS_ID+GUESTID Non-Unique Index
I0000404 STOREENT_ID Non-Unique Index
I0000405 USERS_ID Non-Unique Index
I0000406 ORDERS_ID Non-Unique Index


Constrained By Parent Tables:

Constraint Columns Parent Table Parent Columns Type
F_1052 USERS_ID USERS USERS_ID Cascade
F_1053 STOREENT_ID STOREENT STOREENT_ID Cascade
F_1054 ORDERS_ID ORDERS ORDERS_ID Cascade