CREATE TABLE phpgw_bk_general (
             name            varchar(255) NOT NULL,
             value           text
);

CREATE TABLE phpgw_bk_general_logging (
             date            int NOT NULL,
             name            varchar(255) NOT NULL,
             value           text
);

CREATE TABLE phpgw_bk_entries (
             entry_id        serial,
             account_id      int NOT NULL,
             income_expense  char(1) NOT NULL,
             date_entry      int NOT NULL,
             category_id     int NOT NULL,
             description     text,
             amount          numeric(20,2) NOT NULL
);

CREATE TABLE phpgw_bk_entries_logging (
             date            int NOT NULL,
             entry_id        int NOT NULL,
             account_id      int NOT NULL,
             income_expense  char(1) NOT NULL,
             date_entry      int NOT NULL,
             category_id     int NOT NULL,
             description     text,
             amount          numeric(20,2) NOT NULL
);           

CREATE TABLE phpgw_bk_categories (
             category_id     serial,
             description     varchar(255) NOT NULL,
             income_expense  char(1) NOT NULL
);

CREATE TABLE phpgw_bk_categories_logging (
             date            int NOT NULL,
             category_id     int NOT NULL,
             description     varchar(255) NOT NULL,
             income_expense  char(1) NOT NULL
);

INSERT INTO phpgw_bk_general VALUES ('admins',NULL);
