Release 3.6.1
[kivitendo-erp.git] / sql / Pg-upgrade2 / csv_import_report_cache.sql
1 -- @tag: csv_import_report_cache
2 -- @description: Csv Import Cache
3 -- @depends: csv_import_profiles_2
4
5 CREATE TABLE csv_import_reports (
6   id                   SERIAL PRIMARY KEY,
7   session_id           TEXT NOT NULL,
8   profile_id           INTEGER NOT NULL REFERENCES csv_import_profiles(id),
9   type                 TEXT NOT NULL,
10   file                 TEXT NOT NULL,
11   numrows              INTEGER NOT NULL
12 );
13
14 CREATE TABLE csv_import_report_rows (
15   id                   SERIAL PRIMARY KEY,
16   csv_import_report_id INTEGER NOT NULL REFERENCES csv_import_reports(id),
17   col                  INTEGER NOT NULL,
18   row                  INTEGER NOT NULL,
19   value                TEXT
20 );
21
22 CREATE TABLE csv_import_report_status (
23   id                   SERIAL PRIMARY KEY,
24   csv_import_report_id INTEGER NOT NULL REFERENCES csv_import_reports(id),
25   row                  INTEGER NOT NULL,
26   type                 TEXT NOT NULL,
27   value                TEXT
28 );
29
30 ALTER TABLE csv_import_profiles DROP constraint "csv_import_profiles_name_key";
31
32 CREATE INDEX "csv_import_report_rows_index_row" ON csv_import_report_rows (row);