Database package, schema and queries

This commit is contained in:
2026-06-04 23:41:15 +02:00
parent 25deebb0e1
commit a400ad31bf
6 changed files with 204 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
-- +goose Up
CREATE SCHEMA IF NOT EXISTS fts;
CREATE TABLE fts.transactions (
transaction_id SERIAL PRIMARY KEY,
description TEXT NOT NULL,
amount NUMERIC(12, 2) NOT NULL,
category VARCHAR(50) NOT NULL,
transaction_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP NOT NULL
);
-- Index for querying transactions by date
CREATE INDEX idx_transactions_date ON fts.transactions(transaction_date);
-- +goose Down
DROP INDEX IF EXISTS fts.idx_transactions_date;
DROP TABLE IF EXISTS fts.transactions;