From 4edb2516e2c6bf2efab3f30f1a70dfc35b4b0f51 Mon Sep 17 00:00:00 2001
From: Thibaut Horel <thibaut.horel@gmail.com>
Date: Thu, 13 Oct 2011 18:23:28 +0200
Subject: Basis of database building

* database.sql contains de database schema
* database.py populates the database
---
 database.sql | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 database.sql

(limited to 'database.sql')

diff --git a/database.sql b/database.sql
new file mode 100644
index 0000000..d5cb31d
--- /dev/null
+++ b/database.sql
@@ -0,0 +1,19 @@
+CREATE TABLE stock (
+    stockId serial PRIMARY KEY,
+    ticker varchar(10)
+);
+
+CREATE TABLE history (
+    date date DEFAULT CURRENT_DATE NOT NULL,
+    stockId integer NOT NULL REFERENCES stock ON DELETE CASCADE ON UPDATE CASCADE,
+    open double precision DEFAULT NULL,
+    high double precision DEFAULT NULL,
+    low double precision DEFAULT NULL,
+    close double precision DEFAULT NULL,
+    adjClose double precision DEFAULT NULL,
+    volume integer DEFAULT NULL,
+    div real DEFAULT NULL,
+    adjDiv real DEFAULT NULL,
+    split real DEFAULT NULL,
+    PRIMARY KEY (date, stockid)
+);
-- 
cgit v1.2.3-70-g09d2

