Line # Revision Author
1 270 ahitrov CREATE TABLE webshop_order_coupons (
2 id integer DEFAULT nextval(('public.documents_id_seq'::text)::regclass) NOT NULL,
3 ctime timestamp without time zone DEFAULT now() NOT NULL,
4 mtime timestamp without time zone DEFAULT now() NOT NULL,
5 class text DEFAULT 'webshop::OrderCouponLink'::text NOT NULL,
6 status smallint default 0 NOT NULL,
7 uid integer default 0,
8 session text,
9 source_id integer,
10 source_class text default 'webshop::Order'::text,
11 dest_id integer,
12 dest_class text default 'webshop::Coupon'::text,
13 data text
14 );
15
16 CREATE INDEX webshop_order_coupons_user ON webshop_order_coupons USING btree (uid, session);
17 577 ahitrov CREATE UNIQUE INDEX webshop_order_coupons_in_order ON webshop_order_coupons USING btree (source_id, dest_id) where source_id > 0;
18 270 ahitrov create index webshop_order_coupons_source on webshop_order_coupons (source_id);
19 create index webshop_order_coupons_dest on webshop_order_coupons (dest_id);