pgsql/investigations/ar-cash.sql
[Pman.Xtuple] / pgsql / x-netsuite-stock.sql
1
2 CREATE SEQUENCE netsuite_stock_id_seq
3   INCREMENT 1
4   MINVALUE 1
5   MAXVALUE 2147483647
6   START 1
7   CACHE 1;
8 ALTER TABLE netsuite_stock_id_seq
9   OWNER TO admin;
10 GRANT ALL ON TABLE netsuite_stock_id_seq TO admin;
11 GRANT ALL ON TABLE netsuite_stock_id_seq TO xtrole;
12
13
14 CREATE TABLE netsuite_stock
15 (
16     id integer NOT NULL DEFAULT nextval(('netsuite_stock_id_seq'::text)::regclass),
17     trans_date date,
18     curr_id integer,
19     location_id integer,
20     item_id integer,
21     qty integer,
22     txref text,
23     txtype text,
24
25     amount numeric(14,2),
26     amount_hkd numeric(14,2),
27     CONSTRAINT netsuite_stock_id_pkey PRIMARY KEY (id )
28 )
29 WITH (
30   OIDS=FALSE
31 ); 
32
33 GRANT ALL ON TABLE netsuite_stock TO admin;
34 GRANT ALL ON TABLE netsuite_stock TO xtrole;
35
36 ALTER TABLE  netsuite_stock ADD COLUMN   txline INTEGER DEFAULT 0;
37
38 CREATE INDEX netsuite_stock_trans_date_indx
39   ON netsuite_stock
40   USING btree
41   (trans_date);
42   
43 CREATE INDEX netsuite_stock_location_id_indx
44   ON netsuite_stock
45   USING btree
46   (location_id);
47
48 CREATE INDEX netsuite_stock_item_id_indx
49   ON netsuite_stock
50   USING btree
51   (item_id);