accountant-ui/src/sql/01_init.sql
2013-01-07 18:42:02 +01:00

22 lines
422 B
PL/PgSQL

BEGIN;
CREATE TABLE "account" (
"id" SERIAL PRIMARY KEY,
"name" VARCHAR(200) NOT NULL
);
CREATE TABLE "entry" (
"id" BIGSERIAL PRIMARY KEY,
"value_date" DATE NOT NULL,
"operation_date" DATE,
"label" VARCHAR(500) NOT NULL,
"comment" VARCHAR(500),
"value" NUMERIC(15,4) NOT NULL,
"account_id" INTEGER NOT NULL REFERENCES "account"("id")
);
CREATE INDEX on entry(value_date);
COMMIT;