File: beancounter_schema_postgresql.txt

package info (click to toggle)
beancounter 0.8.8
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 360 kB
  • ctags: 142
  • sloc: perl: 2,592; sh: 744; makefile: 144
file content (181 lines) | stat: -rw-r--r-- 3,897 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
--
-- PostgreSQL database dump
--

SET SESSION AUTHORIZATION 'postgres';

--
-- TOC entry 3 (OID 2200)
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


SET SESSION AUTHORIZATION 'edd';

SET search_path = public, pg_catalog;

--
-- TOC entry 4 (OID 20101)
-- Name: beancounter; Type: TABLE; Schema: public; Owner: edd
--

CREATE TABLE beancounter (
    "version" character varying(12) NOT NULL,
    data_last_updated timestamp with time zone
);


--
-- TOC entry 5 (OID 20104)
-- Name: stockinfo; Type: TABLE; Schema: public; Owner: edd
--

CREATE TABLE stockinfo (
    symbol character varying(12) DEFAULT ''::character varying NOT NULL,
    name character varying(64) DEFAULT ''::character varying NOT NULL,
    exchange character varying(16) DEFAULT ''::character varying NOT NULL,
    capitalisation real,
    low_52weeks real,
    high_52weeks real,
    earnings real,
    dividend real,
    p_e_ratio real,
    avg_volume integer,
    active boolean DEFAULT true
);


--
-- TOC entry 6 (OID 20111)
-- Name: stockprices; Type: TABLE; Schema: public; Owner: edd
--

CREATE TABLE stockprices (
    symbol character varying(12) DEFAULT ''::character varying NOT NULL,
    date date,
    previous_close real,
    day_open real,
    day_low real,
    day_high real,
    day_close real,
    day_change real,
    bid real,
    ask real,
    volume integer
);


--
-- TOC entry 7 (OID 20115)
-- Name: fxprices; Type: TABLE; Schema: public; Owner: edd
--

CREATE TABLE fxprices (
    currency character varying(12) DEFAULT ''::character varying NOT NULL,
    date date,
    previous_close real,
    day_open real,
    day_low real,
    day_high real,
    day_close real,
    day_change real
);


--
-- TOC entry 8 (OID 20119)
-- Name: portfolio; Type: TABLE; Schema: public; Owner: edd
--

CREATE TABLE portfolio (
    symbol character varying(16) DEFAULT ''::character varying NOT NULL,
    shares real,
    currency character varying(12),
    "type" character varying(16),
    "owner" character varying(16),
    cost real,
    date date
);


--
-- TOC entry 9 (OID 20123)
-- Name: cash; Type: TABLE; Schema: public; Owner: edd
--

CREATE TABLE cash (
    name character varying(16) DEFAULT ''::character varying NOT NULL,
    value double precision,
    currency character varying(12),
    "type" character varying(12),
    "owner" character varying(16),
    cost double precision,
    date date
);


--
-- TOC entry 10 (OID 20127)
-- Name: indices; Type: TABLE; Schema: public; Owner: edd
--

CREATE TABLE indices (
    symbol character varying(12) DEFAULT ''::character varying NOT NULL,
    stockindex character varying(12) DEFAULT ''::character varying NOT NULL
);


--
-- TOC entry 11 (OID 20110)
-- Name: stockinfo_pkey; Type: INDEX; Schema: public; Owner: edd
--

CREATE UNIQUE INDEX stockinfo_pkey ON stockinfo USING btree (symbol);


--
-- TOC entry 12 (OID 20114)
-- Name: stockprices_pkey; Type: INDEX; Schema: public; Owner: edd
--

CREATE UNIQUE INDEX stockprices_pkey ON stockprices USING btree (symbol, date);


--
-- TOC entry 13 (OID 20118)
-- Name: fxprices_pkey; Type: INDEX; Schema: public; Owner: edd
--

CREATE UNIQUE INDEX fxprices_pkey ON fxprices USING btree (currency, date);


--
-- TOC entry 14 (OID 20122)
-- Name: portfolio_pkey; Type: INDEX; Schema: public; Owner: edd
--

CREATE UNIQUE INDEX portfolio_pkey ON portfolio USING btree (symbol, "owner", date);


--
-- TOC entry 15 (OID 20126)
-- Name: cash_pkey; Type: INDEX; Schema: public; Owner: edd
--

CREATE UNIQUE INDEX cash_pkey ON cash USING btree (name, "type", "owner", date);


SET SESSION AUTHORIZATION 'postgres';

--
-- TOC entry 2 (OID 2200)
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA public IS 'Standard public namespace';