-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_db.sql
More file actions
28 lines (25 loc) · 765 Bytes
/
Copy pathinit_db.sql
File metadata and controls
28 lines (25 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
CREATE TABLE IF NOT EXISTS import_batches (
id SERIAL PRIMARY KEY,
source_name TEXT NOT NULL,
file_name TEXT NOT NULL,
started_at_utc TIMESTAMP NOT NULL
);
CREATE TABLE IF NOT EXISTS transactions (
id SERIAL PRIMARY KEY,
transaction_date DATE NOT NULL,
description TEXT NOT NULL,
amount NUMERIC(12, 2) NOT NULL,
currency TEXT NOT NULL,
source TEXT NOT NULL,
batch_id INTEGER REFERENCES import_batches(id)
);
CREATE TABLE IF NOT EXISTS data_quality_issues (
id SERIAL PRIMARY KEY,
row_number INTEGER NOT NULL,
raw_description TEXT,
issue_type TEXT NOT NULL,
message TEXT NOT NULL,
batch_id INTEGER REFERENCES import_batches(id)
);
ALTER TABLE transactions
ADD COLUMN IF NOT EXISTS category TEXT;