Mehr Frieden -General Kyrylo Budanov:
[kivitendo-erp.git] / sql / Pg-upgrade2 / sepa.sql
1 -- @tag: sepa
2 -- @description: Tabellen für den SEPA-XML-Exportassistenten
3 -- @depends: release_2_6_0
4 -- @ignore: 0
5 --DROP TABLE sepa_export_items;
6 --DROP TABLE sepa_export;
7 --DROP SEQUENCE sepa_export_id_seq;
8
9 CREATE SEQUENCE sepa_export_id_seq;
10
11 CREATE TABLE sepa_export (
12   id integer NOT NULL DEFAULT nextval('sepa_export_id_seq'),
13   employee_id integer NOT NULL,
14   executed boolean DEFAULT FALSE,
15   closed boolean DEFAULT FALSE,
16   itime timestamp DEFAULT now(),
17
18   PRIMARY KEY (id),
19   FOREIGN KEY (employee_id) REFERENCES employee (id)
20 );
21
22 CREATE TABLE sepa_export_items (
23   id integer NOT NULL DEFAULT nextval('id'),
24   sepa_export_id integer NOT NULL,
25   ap_id integer NOT NULL,
26   chart_id integer NOT NULL,
27   amount NUMERIC(25,5),
28   reference varchar(35),
29   requested_execution_date date,
30   executed boolean DEFAULT FALSE,
31   execution_date date,
32
33   our_iban varchar(100),
34   our_bic varchar(100),
35   vendor_iban varchar(100),
36   vendor_bic varchar(100),
37
38   end_to_end_id varchar(35),
39
40   PRIMARY KEY (id),
41   FOREIGN KEY (sepa_export_id) REFERENCES sepa_export (id),
42   FOREIGN KEY (ap_id) REFERENCES ap (id),
43   FOREIGN KEY (chart_id) REFERENCES chart (id)
44 );