Telefonnotizen: in Berichten Angebot/Auftrag filtern können.
[kivitendo-erp.git] / sql / Pg-upgrade2 / bank_transactions.sql
1 -- @tag: bank_transactions
2 -- @description: Erstellen der Tabelle bank_transactions.
3 -- @depends: release_3_2_0 currencies
4
5 CREATE TABLE bank_transactions (
6   id SERIAL PRIMARY KEY,
7   transaction_id INTEGER,
8   remote_bank_code TEXT,
9   remote_account_number TEXT,
10   transdate DATE NOT NULL,
11   valutadate DATE NOT NULL,
12   amount numeric(15,5) NOT NULL,
13   remote_name TEXT,
14   purpose TEXT,
15   invoice_amount numeric(15,5) DEFAULT 0,
16   local_bank_account_id INTEGER NOT NULL,
17   currency_id INTEGER NOT NULL,
18   cleared BOOLEAN NOT NULL DEFAULT FALSE,
19   itime TIMESTAMP DEFAULT now(),
20   FOREIGN KEY (currency_id)            REFERENCES currencies (id),
21   FOREIGN KEY (local_bank_account_id)  REFERENCES bank_accounts (id)
22 );