34fbdf64916a842d3c21d9cd470ee6b6f5a43a6a
[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 -- @encoding: utf-8
5
6 CREATE TABLE csv_import_reports (
7   id                   SERIAL PRIMARY KEY,
8   session_id           TEXT NOT NULL,
9   profile_id           INTEGER NOT NULL REFERENCES csv_import_profiles(id),
10   type                 TEXT NOT NULL,
11   file                 TEXT NOT NULL,
12   numrows              INTEGER NOT NULL
13 );
14
15 CREATE TABLE csv_import_report_rows (
16   id                   SERIAL PRIMARY KEY,
17   csv_import_report_id INTEGER NOT NULL REFERENCES csv_import_reports(id),
18   col                  INTEGER NOT NULL,
19   row                  INTEGER NOT NULL,
20   value                TEXT
21 );
22
23 CREATE TABLE csv_import_report_status (
24   id                   SERIAL PRIMARY KEY,
25   csv_import_report_id INTEGER NOT NULL REFERENCES csv_import_reports(id),
26   row                  INTEGER NOT NULL,
27   type                 TEXT NOT NULL,
28   value                TEXT
29 );
30
31 ALTER TABLE csv_import_profiles DROP constraint "csv_import_profiles_name_key";
32
33 CREATE INDEX "csv_import_report_rows_index_row" ON csv_import_report_rows (row);