Aktuelle Strukturen
[infodrom.org/infocon.infodrom.org] / misc / schemes
1 DROP TABLE article;
2 DROP TABLE offer;
3 DROP TABLE spool;
4 DROP TABLE customer;
5 DROP TABLE dispatch;
6 DROP TABLE dispatchlist;
7
8 CREATE TABLE article (
9         article VARCHAR(10),
10         name TEXT,
11         description TEXT,
12         url_path TEXT,
13         url_width INT4,
14         url_height INT4,
15         comment TEXT,
16         tax float4
17 );
18 CREATE UNIQUE INDEX "article_id" on "article" using btree ( article );
19 CREATE  INDEX "article_name" on "article" using btree ( name );
20
21 CREATE TABLE offer (
22         articleid VARCHAR(12),
23         article VARCHAR(10),
24         subname TEXT,
25         self_width  FLOAT4,
26         self_height FLOAT4,
27         self_depth  FLOAT4,
28         self_weight FLOAT4,
29         comment TEXT,
30         price float4,
31         price_orig float4
32 );
33 CREATE UNIQUE INDEX "offer_id" on "offer" using btree ( articleid );
34 CREATE  INDEX "offer_offer" on "offer" using btree ( article );
35 CREATE  INDEX "offer_name" on "offer" using btree ( subname );
36
37 CREATE TABLE spool (
38         articleid VARCHAR(12),
39         count_spare int4,
40         count_sold int4
41 );
42 CREATE INDEX "spool_id" on "spool" using btree ( articleid );
43
44 CREATE TABLE customer (
45         customer int4,
46         company TEXT,
47         firstname TEXT,
48         lastname TEXT,
49         appendix TEXT,
50         street TEXT,
51         plz TEXT,
52         city TEXT,
53         country TEXT,
54         comment TEXT,
55         passwd TEXT
56 );
57 CREATE UNIQUE INDEX "customer_id" on "customer" using btree ( customer );
58
59 CREATE TABLE dispatch (
60         dispatch int4,
61         customer int4,
62         date datetime,
63         status int4
64 );
65 CREATE UNIQUE INDEX "dispatch_id" on "dispatch" using btree ( dispatch );
66
67 CREATE TABLE dispatchlist (
68         dispatch int4,
69         articleid varchar(12),
70         quantity int4,
71         unitprice float4
72 );
73 CREATE  INDEX "dispatchlist_orderid" on "dispatchlist" using btree ( dispatch );
74 CREATE  INDEX "dispatchlist_artid"   on "dispatchlist" using btree ( articleid );
75
76 REVOKE ALL on "article" from PUBLIC;
77 GRANT  ALL on "article" to "www";
78 GRANT  ALL on "article" to "joey";
79
80 REVOKE ALL on "offer" from PUBLIC;
81 GRANT  ALL on "offer" to "www";
82 GRANT  ALL on "offer" to "joey";
83
84 REVOKE ALL on "dispatch" from PUBLIC;
85 GRANT  ALL on "dispatch" to "www";
86 GRANT  ALL on "dispatch" to "joey";
87
88 REVOKE ALL on "dispatchlist" from PUBLIC;
89 GRANT  ALL on "dispatchlist" to "www";
90 GRANT  ALL on "dispatchlist" to "joey";
91
92 REVOKE ALL on "customer" from PUBLIC;
93 GRANT  ALL on "customer" to "www";
94 GRANT  ALL on "customer" to "joey";
95
96 REVOKE ALL on "spool" from PUBLIC;
97 GRANT  ALL on "spool" to "www";
98 GRANT  ALL on "spool" to "joey";