26 lines
672 B
SQL
26 lines
672 B
SQL
CREATE TABLE accounts (
|
|
account_id integer PRIMARY KEY,
|
|
name text NOT NULL,
|
|
qualifiedName text NOT NULL,
|
|
description text NOT NULL,
|
|
type TEXT NOT NULL,
|
|
balance float NOT NULL,
|
|
localBalance float NOT NULL
|
|
);
|
|
|
|
CREATE TABLE transactions (
|
|
transaction_id integer PRIMARY KEY,
|
|
postingDate text NOT NULL,
|
|
valueDate text,
|
|
title text NOT NULL
|
|
);
|
|
|
|
CREATE TABLE transaction_entries (
|
|
transaction_id int,
|
|
account_id int,
|
|
amount float,
|
|
label text,
|
|
FOREIGN KEY (transaction_id) REFERENCES transactions (transaction_id) FOREIGN KEY (account_id) REFERENCES account (account_id) PRIMARY KEY (transaction_id, account_id)
|
|
);
|
|
|