2010-05-14 15:04:01 +02:00
CREATE TABLE user ( id INTEGER PRIMARY KEY , name VARCHAR ( 255 ) , password VARCHAR ( 255 ) ) ;
2010-05-17 18:03:21 +02:00
CREATE TABLE account ( id INTEGER PRIMARY KEY , user REFERENCES user ( id ) , name VARCHAR ( 255 ) , number VARCHAR ( 255 ) , shared CHAR ( 1 ) , default_account CHAR ( 1 ) ) ;
2010-05-27 21:09:02 +02:00
CREATE TABLE account_amount ( id INTEGER PRIMARY KEY , account REFERENCES account ( id ) , year INTEGER , month INTEGER , amount FLOAT ) ;
2010-07-02 21:40:32 +02:00
CREATE TABLE operation ( id INTEGER PRIMARY KEY , user REFERENCES user ( id ) , account REFERENCES account ( id ) , year INTEGER , month INTEGER , day INTEGER , amount FLOAT , description VARCHAR ( 255 ) , category REFERENCES category ( id ) , fix_cost CHAR ( 1 ) , checked CHAR ( 1 ) ) ;
CREATE TABLE category ( id INTEGER PRIMARY KEY , user REFERENCES user ( id ) , parent REFERENCES category ( id ) , name VARCHAR ( 255 ) , color VARCHAR ( 255 ) , font VARCHAR ( 255 ) ) ;
CREATE TABLE preference ( id INTEGER PRIMARY KEY , user REFERENCES user ( id ) , name VARCHAR ( 255 ) , value VARCHAR ( 255 ) ) ;
2010-05-14 15:04:01 +02:00
CREATE TABLE default_preference ( id INTEGER PRIMARY KEY , type VARCHAR ( 255 ) , name VARCHAR ( 255 ) , value VARCHAR ( 255 ) ) ;
2010-07-02 21:40:32 +02:00
CREATE TABLE default_category ( id INTEGER PRIMARY KEY , parent REFERENCES category ( id ) , name VARCHAR ( 255 ) , color VARCHAR ( 255 ) , font VARCHAR ( 255 ) ) ;
-- INSERT INTO default_preference ("name", "value") VALUES ("category", "name", "Fixe");
-- INSERT INTO default_preference ("name", "value") VALUES ("category", "name", "Courses");
INSERT INTO default_category ( " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " Fixe " , " #FFFF99 " , " " ) ;
INSERT INTO default_category ( " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " Courses " , " #3DEB3D " , " " ) ;
INSERT INTO default_category ( " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " Loisirs " , " #3DEB3D " , " " ) ;
INSERT INTO default_category ( " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " Frais de fonctionnement " , " #3DEB3D " , " " ) ;
INSERT INTO default_category ( " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " Exceptionnel " , " #3DEB3D " , " " ) ;
INSERT INTO default_category ( " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " Autre " , " #3DEB3D " , " " ) ;
2010-05-16 10:35:34 +02:00
-- No password
2010-05-15 11:21:42 +02:00
INSERT INTO user ( " id " , " name " , " password " ) VALUES ( " 0 " , " Greg " , " da39a3ee5e6b4b0d3255bfef95601890afd80709 " ) ;
2010-05-24 20:14:15 +02:00
INSERT INTO account ( " id " , " user " , " name " , " number " , " shared " , " default_account " ) VALUES ( " 0 " , " 0 " , " Compte Courant " , " 000 " , " 0 " , " 1 " ) ;
2010-06-22 20:46:30 +02:00
-- May 2009
INSERT INTO account_amount ( " id " , " account " , " year " , " month " , " amount " ) VALUES ( " 1 " , " 0 " , " 2009 " , " 4 " , " 500 " ) ;
INSERT INTO operation ( " id " , " user " , " account " , " year " , " month " , " day " , " amount " , " description " , " category " , " fix_cost " , " checked " ) VALUES ( " 1 " , " 0 " , " 0 " , " 2009 " , " 4 " , " 0 " , " 1234 " , " Opé May 1 " , " 1 " , " 1 " , " 0 " ) ;
2010-06-22 15:51:51 +02:00
-- May 2010
2010-06-22 20:46:30 +02:00
INSERT INTO account_amount ( " id " , " account " , " year " , " month " , " amount " ) VALUES ( " 2 " , " 0 " , " 2010 " , " 4 " , " 500 " ) ;
INSERT INTO operation ( " id " , " user " , " account " , " year " , " month " , " day " , " amount " , " description " , " category " , " fix_cost " , " checked " ) VALUES ( " 2 " , " 0 " , " 0 " , " 2010 " , " 4 " , " 0 " , " 1234 " , " Opé May 1 " , " 1 " , " 1 " , " 0 " ) ;
INSERT INTO operation ( " id " , " user " , " account " , " year " , " month " , " day " , " amount " , " description " , " category " , " fix_cost " , " checked " ) VALUES ( " 3 " , " 0 " , " 0 " , " 2010 " , " 4 " , " 1 " , " -56 " , " Opé May 2 " , " 2 " , " 0 " , " 0 " ) ;
2010-06-22 15:51:51 +02:00
-- June 2010
2010-06-22 20:46:30 +02:00
INSERT INTO account_amount ( " id " , " account " , " year " , " month " , " amount " ) VALUES ( " 3 " , " 0 " , " 2010 " , " 5 " , " 1000 " ) ;
INSERT INTO operation ( " id " , " user " , " account " , " year " , " month " , " day " , " amount " , " description " , " category " , " fix_cost " , " checked " ) VALUES ( " 4 " , " 0 " , " 0 " , " 2010 " , " 5 " , " 0 " , " 1234 " , " Opé 1 " , " 1 " , " 1 " , " 0 " ) ;
INSERT INTO operation ( " id " , " user " , " account " , " year " , " month " , " day " , " amount " , " description " , " category " , " fix_cost " , " checked " ) VALUES ( " 5 " , " 0 " , " 0 " , " 2010 " , " 5 " , " 1 " , " -56 " , " Opé 2 " , " 2 " , " 0 " , " 0 " ) ;
INSERT INTO operation ( " id " , " user " , " account " , " year " , " month " , " day " , " amount " , " description " , " category " , " fix_cost " , " checked " ) VALUES ( " 6 " , " 0 " , " 0 " , " 2010 " , " 5 " , " 8 " , " 12 " , " Opé 3 " , " 3 " , " 0 " , " 1 " ) ;
INSERT INTO operation ( " id " , " user " , " account " , " year " , " month " , " day " , " amount " , " description " , " category " , " fix_cost " , " checked " ) VALUES ( " 7 " , " 0 " , " 0 " , " 2010 " , " 5 " , " 29 " , " -2056 " , " Opé 4 " , " 4 " , " 0 " , " 0 " ) ;
2010-07-02 21:40:32 +02:00
INSERT INTO category ( " user " , " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " 0 " , " Fixe " , " #FFFF99 " , " " ) ;
INSERT INTO category ( " user " , " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " 0 " , " Courses " , " #3DEB3D " , " " ) ;
INSERT INTO category ( " user " , " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " 0 " , " Loisirs " , " #3DEB3D " , " " ) ;
INSERT INTO category ( " user " , " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " 0 " , " Frais de fonctionnement " , " #3DEB3D " , " " ) ;
INSERT INTO category ( " user " , " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " 0 " , " Exceptionnel " , " #3DEB3D " , " " ) ;
INSERT INTO category ( " user " , " parent " , " name " , " color " , " font " ) VALUES ( " 0 " , " 0 " , " Autre " , " #3DEB3D " , " " ) ;