accountant/src/sql/01_init.sql

23 lines
452 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"),
"category" VARCHAR(100),
);
CREATE INDEX on entry(value_date);
COMMIT;