diff --git a/src/engine/sql/README b/src/engine/sql/README new file mode 100644 index 0000000000..31de91a2e5 --- /dev/null +++ b/src/engine/sql/README @@ -0,0 +1,20 @@ + +This directory contains very broken, very experimental code +for sql support. It doesn't work. The instructions bwlow are for +developers who want to hack this code. + +1) Install postgresl server, client and devel packages. +2) if installed from redhat, then running /etc/rc.d/init.d/postgresql + will setup and initialize all first-time setup & config. +3) as root, su - postgres then run 'createuser' to add your user id + +4) run the script gnc-init.sh + + + +Development Notes +----------------- +Just about everything done in this demo is wrong. +-- primary keeys need to be built +-- + diff --git a/src/engine/sql/gnc-init.sh b/src/engine/sql/gnc-init.sh new file mode 100755 index 0000000000..e8401b01c5 --- /dev/null +++ b/src/engine/sql/gnc-init.sh @@ -0,0 +1,5 @@ +#! /bin/sh + +# create teh initial database +createdb "gnc_bogus" +psql gnc_bogus < gnc-init.sql diff --git a/src/engine/sql/gnc-init.sql b/src/engine/sql/gnc-init.sql new file mode 100644 index 0000000000..3694d9ebb5 --- /dev/null +++ b/src/engine/sql/gnc-init.sql @@ -0,0 +1,38 @@ + +-- these tables roughly mirror the c structs in TransactionP.h and +-- AccountP.h + +CREATE TABLE gncAccount ( + accountGuid CHAR(16) PRIMARY KEY, + accountName VARCHAR(40) DEFAULT 'xoxo', + accountCode VARCHAR(8), + description VARCHAR(120), + notes VARCHAR(120), + type INT2, + currency VARCHAR(8), + security VARCHAR(8) +); + + +-- a gncEntry is what we call 'Split' elsewhere in the engine + +CREATE TABLE gncEntry ( + entryGuid CHAR(16) PRIMARY KEY, + accountGuid CHAR(16), + transGuid CHAR(16), + memo VARCHAR(20), + action VARCHAR(20), + date_reconciled DATETIME, + amount FLOAT8 DEFAULT '0.0', + share_price FLOAT8 DEFAULT '0.0' +); + +CREATE TABLE gncTransaction ( + transGuid CHAR(16) PRIMARY KEY, + date_entered DATETIME, + date_posted DATETIME, + num VARCHAR(8), + description VARCHAR(32) +); + +