1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
DROP VIEW IF EXISTS view_postindexing;
|
10
|
DROP VIEW IF EXISTS res_view_attachments;
|
11
|
DROP VIEW IF EXISTS res_view_letterbox;
|
12
|
DROP VIEW IF EXISTS view_contacts;
|
13
|
DROP TABLE IF EXISTS ar_batch;
|
14
|
|
15
|
DROP SEQUENCE IF EXISTS priorities_seq CASCADE;
|
16
|
|
17
|
DROP TABLE IF EXISTS priorities;
|
18
|
CREATE TABLE priorities
|
19
|
(
|
20
|
id character varying(16) NOT NULL,
|
21
|
label character varying(128) NOT NULL,
|
22
|
color character varying(128) NOT NULL,
|
23
|
working_days boolean NOT NULL,
|
24
|
delays integer,
|
25
|
default_priority boolean NOT NULL DEFAULT FALSE,
|
26
|
"order" integer,
|
27
|
CONSTRAINT priorities_pkey PRIMARY KEY (id)
|
28
|
)
|
29
|
WITH (OIDS=FALSE);
|
30
|
|
31
|
|
32
|
DROP TABLE IF EXISTS status_images;
|
33
|
CREATE TABLE status_images
|
34
|
(
|
35
|
id serial,
|
36
|
image_name character varying(128) NOT NULL,
|
37
|
CONSTRAINT status_images_pkey PRIMARY KEY (id)
|
38
|
)
|
39
|
WITH (OIDS=FALSE);
|
40
|
|
41
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-new');
|
42
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-inprogress');
|
43
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-info');
|
44
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-wait');
|
45
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-validated');
|
46
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-rejected');
|
47
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-end');
|
48
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-newmail');
|
49
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-attr');
|
50
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-arev');
|
51
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-aval');
|
52
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-aimp');
|
53
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-imp');
|
54
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-aenv');
|
55
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-acla');
|
56
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-status-aarch');
|
57
|
INSERT INTO status_images (image_name) VALUES ('fm-letter');
|
58
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-add');
|
59
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-search');
|
60
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-del');
|
61
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-incoming');
|
62
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-outgoing');
|
63
|
INSERT INTO status_images (image_name) VALUES ('fm-letter-internal');
|
64
|
INSERT INTO status_images (image_name) VALUES ('fm-file-fingerprint');
|
65
|
INSERT INTO status_images (image_name) VALUES ('fm-classification-plan-l1');
|
66
|
|
67
|
|
68
|
ALTER TABLE status DROP COLUMN IF EXISTS identifier;
|
69
|
ALTER TABLE status ADD COLUMN identifier serial;
|
70
|
|
71
|
ALTER TABLE users DROP COLUMN IF EXISTS signature_path;
|
72
|
ALTER TABLE users DROP COLUMN IF EXISTS signature_file_name;
|
73
|
ALTER TABLE users DROP COLUMN IF EXISTS docserver_location_id;
|
74
|
ALTER TABLE users DROP COLUMN IF EXISTS delay_number;
|
75
|
ALTER TABLE users DROP COLUMN IF EXISTS department;
|
76
|
|
77
|
DO $$ BEGIN
|
78
|
IF (SELECT count(attname) FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'users') AND attname = 'id') = 0 THEN
|
79
|
ALTER TABLE users ADD COLUMN id serial;
|
80
|
ALTER TABLE users ADD UNIQUE (id);
|
81
|
END IF;
|
82
|
END$$;
|
83
|
|
84
|
DO $$ BEGIN
|
85
|
IF (SELECT count(attname) FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'user_signatures') AND attname = 'user_id') THEN
|
86
|
ALTER TABLE user_signatures DROP COLUMN IF EXISTS user_serial_id;
|
87
|
ALTER TABLE user_signatures ADD COLUMN user_serial_id integer;
|
88
|
UPDATE user_signatures set user_serial_id = (select id FROM users where users.user_id = user_signatures.user_id);
|
89
|
DELETE from user_signatures where user_serial_id is NULL;
|
90
|
ALTER TABLE user_signatures ALTER COLUMN user_serial_id set not null;
|
91
|
ALTER TABLE user_signatures DROP COLUMN IF EXISTS user_id;
|
92
|
END IF;
|
93
|
END$$;
|
94
|
|
95
|
ALTER TABLE usergroups DROP COLUMN IF EXISTS administrator;
|
96
|
ALTER TABLE usergroups DROP COLUMN IF EXISTS custom_right1;
|
97
|
ALTER TABLE usergroups DROP COLUMN IF EXISTS custom_right2;
|
98
|
ALTER TABLE usergroups DROP COLUMN IF EXISTS custom_right3;
|
99
|
ALTER TABLE usergroups DROP COLUMN IF EXISTS custom_right4;
|
100
|
|
101
|
DO $$ BEGIN
|
102
|
IF (SELECT count(attname) FROM pg_attribute WHERE attrelid = (SELECT oid FROM pg_class WHERE relname = 'usergroups') AND attname = 'id') = 0 THEN
|
103
|
ALTER TABLE usergroups ADD COLUMN id serial NOT NULL;
|
104
|
ALTER TABLE usergroups ADD UNIQUE (id);
|
105
|
END IF;
|
106
|
END$$;
|
107
|
|
108
|
|
109
|
ALTER TABLE sendmail DROP COLUMN IF EXISTS res_version_att_id_list;
|
110
|
ALTER TABLE sendmail ADD COLUMN res_version_att_id_list character varying(255);
|
111
|
|
112
|
|
113
|
UPDATE users set password = '$2y$10$C.QSslBKD3yNMfRPuZfcaubFwPKiCkqqOUyAdOr5FSGKPaePwuEjG', change_password = 'Y' WHERE user_id != 'superadmin';
|
114
|
UPDATE users set password = '$2y$10$Vq244c5s2zmldjblmMXEN./Q2qZrqtGVgrbz/l1WfsUJbLco4E.e.' where user_id = 'superadmin';
|
115
|
|
116
|
|
117
|
ALTER TABLE baskets DROP COLUMN IF EXISTS color;
|
118
|
ALTER TABLE baskets ADD color character varying(16);
|
119
|
DROP TABLE IF EXISTS users_baskets;
|
120
|
CREATE TABLE users_baskets
|
121
|
(
|
122
|
id serial NOT NULL,
|
123
|
user_serial_id integer NOT NULL,
|
124
|
basket_id character varying(32) NOT NULL,
|
125
|
group_id character varying(32) NOT NULL,
|
126
|
color character varying(16),
|
127
|
CONSTRAINT users_baskets_pkey PRIMARY KEY (id)
|
128
|
)
|
129
|
WITH (OIDS=FALSE);
|
130
|
|
131
|
|
132
|
ALTER TABLE entities DROP COLUMN IF EXISTS entity_full_name;
|
133
|
ALTER TABLE entities ADD entity_full_name text;
|
134
|
|
135
|
ALTER TABLE entities DROP COLUMN IF EXISTS archival_agency;
|
136
|
ALTER TABLE entities ADD COLUMN archival_agency character varying(255) DEFAULT 'org_123456789_Archives';
|
137
|
|
138
|
|
139
|
DROP VIEW IF EXISTS res_view_letterbox;
|
140
|
|
141
|
|
142
|
ALTER TABLE res_letterbox ALTER COLUMN priority TYPE character varying(16);
|
143
|
ALTER TABLE res_attachments ALTER COLUMN priority TYPE character varying(16);
|
144
|
ALTER TABLE res_x ALTER COLUMN priority TYPE character varying(16);
|
145
|
ALTER TABLE res_version_attachments ALTER COLUMN priority TYPE character varying(16);
|
146
|
ALTER TABLE res_version_letterbox ALTER COLUMN priority TYPE character varying(16);
|
147
|
ALTER TABLE res_version_x ALTER COLUMN priority TYPE character varying(16);
|
148
|
|
149
|
|
150
|
ALTER TABLE res_letterbox DROP COLUMN IF EXISTS external_id;
|
151
|
ALTER TABLE res_letterbox ADD COLUMN external_id character varying(255);
|
152
|
|
153
|
ALTER TABLE res_letterbox DROP COLUMN IF EXISTS external_link;
|
154
|
ALTER TABLE res_letterbox ADD COLUMN external_link character varying(255);
|
155
|
|
156
|
CREATE OR REPLACE VIEW res_view_letterbox AS
|
157
|
SELECT r.tablename,
|
158
|
r.is_multi_docservers,
|
159
|
r.res_id,
|
160
|
r.type_id,
|
161
|
r.policy_id,
|
162
|
r.cycle_id,
|
163
|
d.description AS type_label,
|
164
|
d.doctypes_first_level_id,
|
165
|
dfl.doctypes_first_level_label,
|
166
|
dfl.css_style AS doctype_first_level_style,
|
167
|
d.doctypes_second_level_id,
|
168
|
dsl.doctypes_second_level_label,
|
169
|
dsl.css_style AS doctype_second_level_style,
|
170
|
r.format,
|
171
|
r.typist,
|
172
|
r.creation_date,
|
173
|
r.modification_date,
|
174
|
r.relation,
|
175
|
r.docserver_id,
|
176
|
r.folders_system_id,
|
177
|
f.folder_id,
|
178
|
f.destination AS folder_destination,
|
179
|
f.is_frozen AS folder_is_frozen,
|
180
|
r.path,
|
181
|
r.filename,
|
182
|
r.fingerprint,
|
183
|
r.offset_doc,
|
184
|
r.filesize,
|
185
|
r.status,
|
186
|
r.work_batch,
|
187
|
r.arbatch_id,
|
188
|
r.arbox_id,
|
189
|
r.page_count,
|
190
|
r.is_paper,
|
191
|
r.doc_date,
|
192
|
r.scan_date,
|
193
|
r.scan_user,
|
194
|
r.scan_location,
|
195
|
r.scan_wkstation,
|
196
|
r.scan_batch,
|
197
|
r.doc_language,
|
198
|
r.description,
|
199
|
r.source,
|
200
|
r.author,
|
201
|
r.reference_number,
|
202
|
r.external_id,
|
203
|
r.external_link,
|
204
|
r.custom_t1 AS doc_custom_t1,
|
205
|
r.custom_t2 AS doc_custom_t2,
|
206
|
r.custom_t3 AS doc_custom_t3,
|
207
|
r.custom_t4 AS doc_custom_t4,
|
208
|
r.custom_t5 AS doc_custom_t5,
|
209
|
r.custom_t6 AS doc_custom_t6,
|
210
|
r.custom_t7 AS doc_custom_t7,
|
211
|
r.custom_t8 AS doc_custom_t8,
|
212
|
r.custom_t9 AS doc_custom_t9,
|
213
|
r.custom_t10 AS doc_custom_t10,
|
214
|
r.custom_t11 AS doc_custom_t11,
|
215
|
r.custom_t12 AS doc_custom_t12,
|
216
|
r.custom_t13 AS doc_custom_t13,
|
217
|
r.custom_t14 AS doc_custom_t14,
|
218
|
r.custom_t15 AS doc_custom_t15,
|
219
|
r.custom_d1 AS doc_custom_d1,
|
220
|
r.custom_d2 AS doc_custom_d2,
|
221
|
r.custom_d3 AS doc_custom_d3,
|
222
|
r.custom_d4 AS doc_custom_d4,
|
223
|
r.custom_d5 AS doc_custom_d5,
|
224
|
r.custom_d6 AS doc_custom_d6,
|
225
|
r.custom_d7 AS doc_custom_d7,
|
226
|
r.custom_d8 AS doc_custom_d8,
|
227
|
r.custom_d9 AS doc_custom_d9,
|
228
|
r.custom_d10 AS doc_custom_d10,
|
229
|
r.custom_n1 AS doc_custom_n1,
|
230
|
r.custom_n2 AS doc_custom_n2,
|
231
|
r.custom_n3 AS doc_custom_n3,
|
232
|
r.custom_n4 AS doc_custom_n4,
|
233
|
r.custom_n5 AS doc_custom_n5,
|
234
|
r.custom_f1 AS doc_custom_f1,
|
235
|
r.custom_f2 AS doc_custom_f2,
|
236
|
r.custom_f3 AS doc_custom_f3,
|
237
|
r.custom_f4 AS doc_custom_f4,
|
238
|
r.custom_f5 AS doc_custom_f5,
|
239
|
f.foldertype_id,
|
240
|
ft.foldertype_label,
|
241
|
f.custom_t1 AS fold_custom_t1,
|
242
|
f.custom_t2 AS fold_custom_t2,
|
243
|
f.custom_t3 AS fold_custom_t3,
|
244
|
f.custom_t4 AS fold_custom_t4,
|
245
|
f.custom_t5 AS fold_custom_t5,
|
246
|
f.custom_t6 AS fold_custom_t6,
|
247
|
f.custom_t7 AS fold_custom_t7,
|
248
|
f.custom_t8 AS fold_custom_t8,
|
249
|
f.custom_t9 AS fold_custom_t9,
|
250
|
f.custom_t10 AS fold_custom_t10,
|
251
|
f.custom_t11 AS fold_custom_t11,
|
252
|
f.custom_t12 AS fold_custom_t12,
|
253
|
f.custom_t13 AS fold_custom_t13,
|
254
|
f.custom_t14 AS fold_custom_t14,
|
255
|
f.custom_t15 AS fold_custom_t15,
|
256
|
f.custom_d1 AS fold_custom_d1,
|
257
|
f.custom_d2 AS fold_custom_d2,
|
258
|
f.custom_d3 AS fold_custom_d3,
|
259
|
f.custom_d4 AS fold_custom_d4,
|
260
|
f.custom_d5 AS fold_custom_d5,
|
261
|
f.custom_d6 AS fold_custom_d6,
|
262
|
f.custom_d7 AS fold_custom_d7,
|
263
|
f.custom_d8 AS fold_custom_d8,
|
264
|
f.custom_d9 AS fold_custom_d9,
|
265
|
f.custom_d10 AS fold_custom_d10,
|
266
|
f.custom_n1 AS fold_custom_n1,
|
267
|
f.custom_n2 AS fold_custom_n2,
|
268
|
f.custom_n3 AS fold_custom_n3,
|
269
|
f.custom_n4 AS fold_custom_n4,
|
270
|
f.custom_n5 AS fold_custom_n5,
|
271
|
f.custom_f1 AS fold_custom_f1,
|
272
|
f.custom_f2 AS fold_custom_f2,
|
273
|
f.custom_f3 AS fold_custom_f3,
|
274
|
f.custom_f4 AS fold_custom_f4,
|
275
|
f.custom_f5 AS fold_custom_f5,
|
276
|
f.is_complete AS fold_complete,
|
277
|
f.status AS fold_status,
|
278
|
f.subject AS fold_subject,
|
279
|
f.parent_id AS fold_parent_id,
|
280
|
f.folder_level,
|
281
|
f.folder_name,
|
282
|
f.creation_date AS fold_creation_date,
|
283
|
r.initiator,
|
284
|
r.destination,
|
285
|
r.dest_user,
|
286
|
r.confidentiality,
|
287
|
mlb.category_id,
|
288
|
mlb.exp_contact_id,
|
289
|
mlb.exp_user_id,
|
290
|
mlb.dest_user_id,
|
291
|
mlb.dest_contact_id,
|
292
|
mlb.address_id,
|
293
|
mlb.nature_id,
|
294
|
mlb.alt_identifier,
|
295
|
mlb.admission_date,
|
296
|
mlb.answer_type_bitmask,
|
297
|
mlb.other_answer_desc,
|
298
|
mlb.sve_start_date,
|
299
|
mlb.sve_identifier,
|
300
|
mlb.process_limit_date,
|
301
|
mlb.recommendation_limit_date,
|
302
|
mlb.closing_date,
|
303
|
mlb.alarm1_date,
|
304
|
mlb.alarm2_date,
|
305
|
mlb.flag_notif,
|
306
|
mlb.flag_alarm1,
|
307
|
mlb.flag_alarm2,
|
308
|
mlb.is_multicontacts,
|
309
|
r.video_user,
|
310
|
r.video_time,
|
311
|
r.video_batch,
|
312
|
r.subject,
|
313
|
r.identifier,
|
314
|
r.title,
|
315
|
r.priority,
|
316
|
mlb.process_notes,
|
317
|
r.locker_user_id,
|
318
|
r.locker_time,
|
319
|
ca.case_id,
|
320
|
ca.case_label,
|
321
|
ca.case_description,
|
322
|
en.entity_label,
|
323
|
en.entity_type AS entitytype,
|
324
|
cont.contact_id,
|
325
|
cont.firstname AS contact_firstname,
|
326
|
cont.lastname AS contact_lastname,
|
327
|
cont.society AS contact_society,
|
328
|
u.lastname AS user_lastname,
|
329
|
u.firstname AS user_firstname,
|
330
|
r.is_frozen AS res_is_frozen
|
331
|
FROM doctypes d,
|
332
|
doctypes_first_level dfl,
|
333
|
doctypes_second_level dsl,
|
334
|
res_letterbox r
|
335
|
LEFT JOIN entities en ON r.destination::text = en.entity_id::text
|
336
|
LEFT JOIN folders f ON r.folders_system_id = f.folders_system_id
|
337
|
LEFT JOIN cases_res cr ON r.res_id = cr.res_id
|
338
|
LEFT JOIN mlb_coll_ext mlb ON mlb.res_id = r.res_id
|
339
|
LEFT JOIN foldertypes ft ON f.foldertype_id = ft.foldertype_id AND f.status::text <> 'DEL'::text
|
340
|
LEFT JOIN cases ca ON cr.case_id = ca.case_id
|
341
|
LEFT JOIN contacts_v2 cont ON mlb.exp_contact_id = cont.contact_id OR mlb.dest_contact_id = cont.contact_id
|
342
|
LEFT JOIN users u ON mlb.exp_user_id::text = u.user_id::text OR mlb.dest_user_id::text = u.user_id::text
|
343
|
WHERE r.type_id = d.type_id AND d.doctypes_first_level_id = dfl.doctypes_first_level_id AND d.doctypes_second_level_id = dsl.doctypes_second_level_id;
|
344
|
|
345
|
ALTER TABLE baskets DROP COLUMN IF EXISTS color;
|
346
|
ALTER TABLE baskets ADD color character varying(16);
|
347
|
|
348
|
|
349
|
ALTER TABLE res_attachments DROP COLUMN IF EXISTS in_signature_book;
|
350
|
ALTER TABLE res_attachments ADD in_signature_book boolean default false;
|
351
|
ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS in_signature_book;
|
352
|
ALTER TABLE res_version_attachments ADD in_signature_book boolean default false;
|
353
|
ALTER TABLE res_attachments DROP COLUMN IF EXISTS signatory_user_serial_id;
|
354
|
ALTER TABLE res_attachments ADD signatory_user_serial_id int;
|
355
|
ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS signatory_user_serial_id;
|
356
|
ALTER TABLE res_version_attachments ADD signatory_user_serial_id int;
|
357
|
ALTER TABLE listinstance DROP COLUMN IF EXISTS signatory;
|
358
|
ALTER TABLE listinstance ADD signatory boolean default false;
|
359
|
ALTER TABLE listinstance DROP COLUMN IF EXISTS requested_signature;
|
360
|
ALTER TABLE listinstance ADD requested_signature boolean default false;
|
361
|
|
362
|
CREATE VIEW res_view_attachments AS
|
363
|
SELECT '0' as res_id, res_id as res_id_version, title, subject, description, publisher, contributor, type_id, format, typist,
|
364
|
creation_date, fulltext_result, ocr_result, author, author_name, identifier, source,
|
365
|
doc_language, relation, coverage, doc_date, docserver_id, folders_system_id, arbox_id, path,
|
366
|
filename, offset_doc, logical_adr, fingerprint, filesize, is_paper, page_count,
|
367
|
scan_date, scan_user, scan_location, scan_wkstation, scan_batch, burn_batch, scan_postmark,
|
368
|
envelop_id, status, destination, approver, validation_date, effective_date, work_batch, origin, is_ingoing, priority, initiator, dest_user,
|
369
|
coll_id, dest_contact_id, dest_address_id, updated_by, is_multicontacts, is_multi_docservers, res_id_master, attachment_type, attachment_id_master, in_signature_book, signatory_user_serial_id
|
370
|
FROM res_version_attachments
|
371
|
UNION ALL
|
372
|
SELECT res_id, '0' as res_id_version, title, subject, description, publisher, contributor, type_id, format, typist,
|
373
|
creation_date, fulltext_result, ocr_result, author, author_name, identifier, source,
|
374
|
doc_language, relation, coverage, doc_date, docserver_id, folders_system_id, arbox_id, path,
|
375
|
filename, offset_doc, logical_adr, fingerprint, filesize, is_paper, page_count,
|
376
|
scan_date, scan_user, scan_location, scan_wkstation, scan_batch, burn_batch, scan_postmark,
|
377
|
envelop_id, status, destination, approver, validation_date, effective_date, work_batch, origin, is_ingoing, priority, initiator, dest_user,
|
378
|
coll_id, dest_contact_id, dest_address_id, updated_by, is_multicontacts, is_multi_docservers, res_id_master, attachment_type, '0', in_signature_book, signatory_user_serial_id
|
379
|
FROM res_attachments;
|
380
|
|
381
|
UPDATE res_attachments SET in_signature_book = TRUE;
|
382
|
UPDATE res_version_attachments SET in_signature_book = TRUE;
|
383
|
UPDATE listinstance SET signatory = TRUE WHERE item_mode = 'sign';
|
384
|
|
385
|
ALTER TABLE notif_event_stack ALTER COLUMN record_id TYPE character varying(128);
|
386
|
|
387
|
|
388
|
ALTER TABLE groupbasket DROP COLUMN IF EXISTS sequence;
|
389
|
ALTER TABLE groupbasket DROP COLUMN IF EXISTS redirect_basketlist;
|
390
|
ALTER TABLE groupbasket DROP COLUMN IF EXISTS redirect_grouplist;
|
391
|
ALTER TABLE groupbasket DROP COLUMN IF EXISTS can_redirect;
|
392
|
ALTER TABLE groupbasket DROP COLUMN IF EXISTS can_delete;
|
393
|
ALTER TABLE groupbasket DROP COLUMN IF EXISTS can_insert;
|
394
|
ALTER TABLE groupbasket DROP COLUMN IF EXISTS list_lock_clause;
|
395
|
ALTER TABLE groupbasket DROP COLUMN IF EXISTS sublist_lock_clause;
|
396
|
DROP TABLE IF EXISTS groupbasket_difflist_types;
|
397
|
DROP TABLE IF EXISTS groupbasket_difflist_roles;
|
398
|
|
399
|
|
400
|
ALTER TABLE listmodels DROP COLUMN IF EXISTS listmodel_type;
|
401
|
ALTER TABLE listmodels DROP COLUMN IF EXISTS coll_id;
|
402
|
|
403
|
ALTER TABLE listmodels DROP COLUMN IF EXISTS id;
|
404
|
ALTER TABLE listmodels ADD id serial NOT NULL;
|
405
|
|
406
|
UPDATE listmodels SET title = description WHERE title = '' OR title ISNULL;
|
407
|
|
408
|
|
409
|
DROP TABLE IF EXISTS indexingmodels;
|
410
|
CREATE TABLE indexingmodels
|
411
|
(
|
412
|
id serial NOT NULL,
|
413
|
label character varying(255) NOT NULL,
|
414
|
fields_content text NOT NULL,
|
415
|
CONSTRAINT indexingmodels_pkey PRIMARY KEY (id)
|
416
|
)
|
417
|
WITH (
|
418
|
OIDS=FALSE
|
419
|
);
|
420
|
|
421
|
|
422
|
|
423
|
|
424
|
|
425
|
|
426
|
ALTER TABLE adr_x DROP COLUMN IF EXISTS adr_type;
|
427
|
ALTER TABLE adr_x ADD COLUMN adr_type character varying(32) NOT NULL DEFAULT 'DOC';
|
428
|
ALTER TABLE adr_attachments DROP COLUMN IF EXISTS adr_type;
|
429
|
ALTER TABLE adr_attachments ADD COLUMN adr_type character varying(32) NOT NULL DEFAULT 'DOC';
|
430
|
|
431
|
|
432
|
|
433
|
ALTER TABLE res_attachments DROP COLUMN IF EXISTS convert_result;
|
434
|
ALTER TABLE res_attachments ADD COLUMN convert_result character varying(10) DEFAULT NULL::character varying;
|
435
|
ALTER TABLE res_letterbox DROP COLUMN IF EXISTS convert_result;
|
436
|
ALTER TABLE res_letterbox ADD COLUMN convert_result character varying(10) DEFAULT NULL::character varying;
|
437
|
ALTER TABLE res_x DROP COLUMN IF EXISTS convert_result;
|
438
|
ALTER TABLE res_x ADD COLUMN convert_result character varying(10) DEFAULT NULL::character varying;
|
439
|
ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS convert_result;
|
440
|
ALTER TABLE res_version_attachments ADD COLUMN convert_result character varying(10) DEFAULT NULL::character varying;
|
441
|
|
442
|
|
443
|
|
444
|
ALTER TABLE res_attachments DROP COLUMN IF EXISTS convert_attempts;
|
445
|
ALTER TABLE res_attachments ADD COLUMN convert_attempts integer DEFAULT NULL::integer;
|
446
|
ALTER TABLE res_letterbox DROP COLUMN IF EXISTS convert_attempts;
|
447
|
ALTER TABLE res_letterbox ADD COLUMN convert_attempts integer DEFAULT NULL::integer;
|
448
|
ALTER TABLE res_x DROP COLUMN IF EXISTS convert_attempts;
|
449
|
ALTER TABLE res_x ADD COLUMN convert_attempts integer DEFAULT NULL::integer;
|
450
|
ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS convert_attempts;
|
451
|
ALTER TABLE res_version_attachments ADD COLUMN convert_attempts integer DEFAULT NULL::integer;
|
452
|
|
453
|
|
454
|
ALTER TABLE res_attachments DROP COLUMN IF EXISTS fulltext_attempts;
|
455
|
ALTER TABLE res_attachments ADD COLUMN fulltext_attempts integer DEFAULT NULL::integer;
|
456
|
ALTER TABLE res_letterbox DROP COLUMN IF EXISTS fulltext_attempts;
|
457
|
ALTER TABLE res_letterbox ADD COLUMN fulltext_attempts integer DEFAULT NULL::integer;
|
458
|
ALTER TABLE res_x DROP COLUMN IF EXISTS fulltext_attempts;
|
459
|
ALTER TABLE res_x ADD COLUMN fulltext_attempts integer DEFAULT NULL::integer;
|
460
|
ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS fulltext_attempts;
|
461
|
ALTER TABLE res_version_attachments ADD COLUMN fulltext_attempts integer DEFAULT NULL::integer;
|
462
|
|
463
|
|
464
|
ALTER TABLE res_attachments DROP COLUMN IF EXISTS tnl_attempts;
|
465
|
ALTER TABLE res_attachments ADD COLUMN tnl_attempts integer DEFAULT NULL::integer;
|
466
|
ALTER TABLE res_letterbox DROP COLUMN IF EXISTS tnl_attempts;
|
467
|
ALTER TABLE res_letterbox ADD COLUMN tnl_attempts integer DEFAULT NULL::integer;
|
468
|
ALTER TABLE res_x DROP COLUMN IF EXISTS tnl_attempts;
|
469
|
ALTER TABLE res_x ADD COLUMN tnl_attempts integer DEFAULT NULL::integer;
|
470
|
ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS tnl_attempts;
|
471
|
ALTER TABLE res_version_attachments ADD COLUMN tnl_attempts integer DEFAULT NULL::integer;
|
472
|
|
473
|
|
474
|
|
475
|
|
476
|
ALTER TABLE res_attachments DROP COLUMN IF EXISTS tnl_result;
|
477
|
ALTER TABLE res_attachments ADD COLUMN tnl_result character varying(10) DEFAULT NULL::character varying;
|
478
|
ALTER TABLE res_letterbox DROP COLUMN IF EXISTS tnl_result;
|
479
|
ALTER TABLE res_letterbox ADD COLUMN tnl_result character varying(10) DEFAULT NULL::character varying;
|
480
|
ALTER TABLE res_x DROP COLUMN IF EXISTS tnl_result;
|
481
|
ALTER TABLE res_x ADD COLUMN tnl_result character varying(10) DEFAULT NULL::character varying;
|
482
|
ALTER TABLE res_version_attachments DROP COLUMN IF EXISTS tnl_result;
|
483
|
ALTER TABLE res_version_attachments ADD COLUMN tnl_result character varying(10) DEFAULT NULL::character varying;
|
484
|
|
485
|
|
486
|
DROP TABLE IF EXISTS adr_letterbox;
|
487
|
CREATE TABLE adr_letterbox
|
488
|
(
|
489
|
res_id bigint NOT NULL,
|
490
|
docserver_id character varying(32) NOT NULL,
|
491
|
path character varying(255) DEFAULT NULL::character varying,
|
492
|
filename character varying(255) DEFAULT NULL::character varying,
|
493
|
offset_doc character varying(255) DEFAULT NULL::character varying,
|
494
|
fingerprint character varying(255) DEFAULT NULL::character varying,
|
495
|
adr_priority integer NOT NULL,
|
496
|
adr_type character varying(32) NOT NULL DEFAULT 'DOC'::character varying,
|
497
|
CONSTRAINT adr_letterbox_pkey PRIMARY KEY (res_id, docserver_id)
|
498
|
)
|
499
|
WITH (OIDS=FALSE);
|
500
|
|
501
|
|
502
|
DROP TABLE IF EXISTS adr_attachments;
|
503
|
CREATE TABLE adr_attachments
|
504
|
(
|
505
|
res_id bigint NOT NULL,
|
506
|
docserver_id character varying(32) NOT NULL,
|
507
|
path character varying(255) DEFAULT NULL::character varying,
|
508
|
filename character varying(255) DEFAULT NULL::character varying,
|
509
|
offset_doc character varying(255) DEFAULT NULL::character varying,
|
510
|
fingerprint character varying(255) DEFAULT NULL::character varying,
|
511
|
adr_priority integer NOT NULL,
|
512
|
adr_type character varying(32) NOT NULL DEFAULT 'DOC'::character varying,
|
513
|
CONSTRAINT adr_attachments_pkey PRIMARY KEY (res_id, docserver_id)
|
514
|
)
|
515
|
WITH (OIDS=FALSE);
|
516
|
|
517
|
|
518
|
DROP TABLE IF EXISTS adr_attachments_version;
|
519
|
CREATE TABLE adr_attachments_version
|
520
|
(
|
521
|
res_id bigint NOT NULL,
|
522
|
docserver_id character varying(32) NOT NULL,
|
523
|
path character varying(255) DEFAULT NULL::character varying,
|
524
|
filename character varying(255) DEFAULT NULL::character varying,
|
525
|
offset_doc character varying(255) DEFAULT NULL::character varying,
|
526
|
fingerprint character varying(255) DEFAULT NULL::character varying,
|
527
|
adr_priority integer NOT NULL,
|
528
|
adr_type character varying(32) NOT NULL DEFAULT 'DOC'::character varying,
|
529
|
CONSTRAINT adr_attachments_version_pkey PRIMARY KEY (res_id, docserver_id)
|
530
|
)
|
531
|
WITH (OIDS=FALSE);
|
532
|
|
533
|
|
534
|
DROP TABLE IF EXISTS convert_stack;
|
535
|
CREATE TABLE convert_stack
|
536
|
(
|
537
|
coll_id character varying(32) NOT NULL,
|
538
|
res_id bigint NOT NULL,
|
539
|
convert_format character varying(32) NOT NULL DEFAULT 'pdf'::character varying,
|
540
|
cnt_retry integer,
|
541
|
status character(1) NOT NULL,
|
542
|
work_batch bigint,
|
543
|
regex character varying(32),
|
544
|
CONSTRAINT convert_stack_pkey PRIMARY KEY (coll_id, res_id, convert_format)
|
545
|
)
|
546
|
WITH (OIDS=FALSE);
|
547
|
|
548
|
|
549
|
UPDATE docservers set docserver_type_id = 'DOC' where docserver_type_id <> 'TEMPLATES' and docserver_type_id <> 'TNL';
|
550
|
|
551
|
|
552
|
DELETE FROM docserver_types where docserver_type_id = 'DOC';
|
553
|
INSERT INTO docserver_types (docserver_type_id, docserver_type_label, enabled, is_container, container_max_number, is_compressed, compression_mode, is_meta, meta_template, is_logged, log_template, is_signed, fingerprint_mode)
|
554
|
VALUES ('DOC', 'Documents', 'Y', 'N', 0, 'N', 'NONE', 'N', 'NONE', 'N', 'NONE', 'Y', 'SHA512');
|
555
|
|
556
|
DELETE FROM docserver_types where docserver_type_id = 'CONVERT';
|
557
|
INSERT INTO docserver_types (docserver_type_id, docserver_type_label, enabled, is_container, container_max_number, is_compressed, compression_mode, is_meta, meta_template, is_logged, log_template, is_signed, fingerprint_mode)
|
558
|
VALUES ('CONVERT', 'Conversions', 'Y', 'N', 0, 'N', 'NONE', 'N', 'NONE', 'N', 'NONE', 'Y', 'SHA256');
|
559
|
|
560
|
DELETE FROM docservers where docserver_id = 'CONVERT_MLB';
|
561
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
562
|
VALUES ('CONVERT_MLB', 'CONVERT', 'Server for mlb documents conversion', 'N', 'Y', 50000000000, 0, '/opt/maarch/docservers/convert_mlb/', NULL, NULL, NULL, '2015-03-16 14:47:49.197164', NULL, 'letterbox_coll', 13, 'NANTERRE', 4);
|
563
|
|
564
|
DELETE FROM docservers where docserver_id = 'FASTHD_ATTACH';
|
565
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
566
|
VALUES ('FASTHD_ATTACH', 'FASTHD', 'Fast internal disc bay for attachments', 'N', 'Y', 50000000000, 1, '/opt/maarch/docservers/manual_attachments/', NULL, NULL, NULL, '2011-01-13 14:47:49.197164', NULL, 'attachments_coll', 2, 'NANTERRE', 3);
|
567
|
|
568
|
DELETE FROM docservers where docserver_id = 'FASTHD_ATTACH_VERSION';
|
569
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
570
|
VALUES ('FASTHD_ATTACH_VERSION', 'FASTHD', 'Fast internal disc bay for attachments version', 'N', 'Y', 50000000000, 1, '/opt/maarch/docservers/manual_attachments_version/', NULL, NULL, NULL, '2011-01-13 14:47:49.197164', NULL, 'attachments_version_coll', 100, 'NANTERRE', 100);
|
571
|
|
572
|
DELETE FROM docservers where docserver_id = 'CONVERT_ATTACH';
|
573
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
574
|
VALUES ('CONVERT_ATTACH', 'CONVERT', 'Server for attachments documents conversion', 'N', 'Y', 50000000000, 0, '/opt/maarch/docservers/convert_attachments/', NULL, NULL, NULL, '2015-03-16 14:47:49.197164', NULL, 'attachments_coll', 14, 'NANTERRE', 5);
|
575
|
|
576
|
DELETE FROM docservers where docserver_id = 'CONVERT_ATTACH_VERSION';
|
577
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
578
|
VALUES ('CONVERT_ATTACH_VERSION', 'CONVERT', 'Server for attachments version documents conversion', 'N', 'Y', 50000000000, 0, '/opt/maarch/docservers/convert_attachments_version/', NULL, NULL, NULL, '2015-03-16 14:47:49.197164', NULL, 'attachments_version_coll', 101, 'NANTERRE', 101);
|
579
|
|
580
|
|
581
|
DELETE FROM docservers where docserver_id = 'TNL_ATTACH';
|
582
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
583
|
VALUES ('TNL_ATTACH', 'TNL', 'Server for thumbnails of attachments', 'N', 'Y', 50000000000, 0, '/opt/maarch/docservers/thumbnails_attachments/', NULL, NULL, NULL, '2015-03-16 14:47:49.197164', NULL, 'attachments_coll', 15, 'NANTERRE', 6);
|
584
|
|
585
|
DELETE FROM docservers where docserver_id = 'TNL_ATTACH_VERSION';
|
586
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
587
|
VALUES ('TNL_ATTACH_VERSION', 'TNL', 'Server for thumbnails of attachments version', 'N', 'Y', 50000000000, 0, '/opt/maarch/docservers/thumbnails_attachments_version/', NULL, NULL, NULL, '2015-03-16 14:47:49.197164', NULL, 'attachments_version_coll', 102, 'NANTERRE', 102);
|
588
|
|
589
|
update docservers set docserver_id = 'TNL_MLB', priority_number = 12 where docserver_id = 'TNL';
|
590
|
|
591
|
DELETE FROM docserver_types where docserver_type_id = 'FULLTEXT';
|
592
|
INSERT INTO docserver_types (docserver_type_id, docserver_type_label, enabled, is_container, container_max_number, is_compressed, compression_mode, is_meta, meta_template, is_logged, log_template, is_signed, fingerprint_mode)
|
593
|
VALUES ('FULLTEXT', 'FULLTEXT', 'Y', 'N', 0, 'N', 'NONE', 'N', 'NONE', 'N', 'NONE', 'Y', 'SHA256');
|
594
|
|
595
|
DELETE FROM docservers where docserver_id = 'FULLTEXT_MLB';
|
596
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
597
|
VALUES ('FULLTEXT_MLB', 'FULLTEXT', 'Server for mlb documents fulltext', 'N', 'Y', 50000000000, 0, '/opt/maarch/docservers/fulltext_mlb/', NULL, NULL, NULL, '2015-03-16 14:47:49.197164', NULL, 'letterbox_coll', 16, 'NANTERRE', 7);
|
598
|
|
599
|
DELETE FROM docservers where docserver_id = 'FULLTEXT_ATTACH';
|
600
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
601
|
VALUES ('FULLTEXT_ATTACH', 'FULLTEXT', 'Server for attachments documents fulltext', 'N', 'Y', 50000000000, 0, '/opt/maarch/docservers/fulltext_attachments/', NULL, NULL, NULL, '2015-03-16 14:47:49.197164', NULL, 'attachments_coll', 17, 'NANTERRE', 8);
|
602
|
|
603
|
DELETE FROM docservers where docserver_id = 'FULLTEXT_ATTACH_VERSION';
|
604
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
605
|
VALUES ('FULLTEXT_ATTACH_VERSION', 'FULLTEXT', 'Server for attachments version documents fulltext', 'N', 'Y', 50000000000, 0, '/opt/maarch/docservers/fulltext_attachments_version/', NULL, NULL, NULL, '2015-03-16 14:47:49.197164', NULL, 'attachments_version_coll', 103, 'NANTERRE', 103);
|
606
|
|
607
|
ALTER TABLE doctypes DROP COLUMN IF EXISTS primary_retention;
|
608
|
ALTER TABLE doctypes DROP COLUMN IF EXISTS secondary_retention;
|
609
|
ALTER TABLE doctypes DROP COLUMN IF EXISTS retention_final_disposition;
|
610
|
ALTER TABLE doctypes ADD COLUMN retention_final_disposition character varying(255) DEFAULT NULL;
|
611
|
ALTER TABLE doctypes DROP COLUMN IF EXISTS retention_rule;
|
612
|
ALTER TABLE doctypes ADD COLUMN retention_rule character varying(15) DEFAULT NULL;
|
613
|
ALTER TABLE doctypes DROP COLUMN IF EXISTS duration_current_use;
|
614
|
ALTER TABLE doctypes ADD COLUMN duration_current_use integer DEFAULT NULL;
|
615
|
ALTER TABLE entities DROP COLUMN IF EXISTS archival_agency;
|
616
|
ALTER TABLE entities ADD COLUMN archival_agency character varying(255) DEFAULT 'org_123456789_Archives';
|
617
|
ALTER TABLE entities DROP COLUMN IF EXISTS archival_agreement;
|
618
|
ALTER TABLE entities ADD COLUMN archival_agreement character varying(255) DEFAULT 'MAARCH_LES_BAINS_ACTES';
|
619
|
|
620
|
UPDATE listmodels SET title = description WHERE title = '' OR title ISNULL;
|
621
|
|
622
|
UPDATE doctypes_first_level SET css_style = '#D2B48C' WHERE css_style = 'beige';
|
623
|
UPDATE doctypes_first_level SET css_style = '#0000FF' WHERE css_style = 'blue_style';
|
624
|
UPDATE doctypes_first_level SET css_style = '#0000FF' WHERE css_style = 'blue_style_big';
|
625
|
UPDATE doctypes_first_level SET css_style = '#808080' WHERE css_style = 'grey_style';
|
626
|
UPDATE doctypes_first_level SET css_style = '#FFFF00' WHERE css_style = 'yellow_style';
|
627
|
UPDATE doctypes_first_level SET css_style = '#800000' WHERE css_style = 'brown_style';
|
628
|
UPDATE doctypes_first_level SET css_style = '#000000' WHERE css_style = 'black_style';
|
629
|
UPDATE doctypes_first_level SET css_style = '#000000' WHERE css_style = 'black_style_big';
|
630
|
UPDATE doctypes_first_level SET css_style = '#FF4500' WHERE css_style = 'orange_style';
|
631
|
UPDATE doctypes_first_level SET css_style = '#FF4500' WHERE css_style = 'orange_style_big';
|
632
|
UPDATE doctypes_first_level SET css_style = '#FF00FF' WHERE css_style = 'pink_style';
|
633
|
UPDATE doctypes_first_level SET css_style = '#FF0000' WHERE css_style = 'red_style';
|
634
|
UPDATE doctypes_first_level SET css_style = '#008000' WHERE css_style = 'green_style';
|
635
|
UPDATE doctypes_first_level SET css_style = '#800080' WHERE css_style = 'violet_style';
|
636
|
UPDATE doctypes_first_level SET css_style = '#000000' WHERE css_style = 'default_style';
|
637
|
|
638
|
UPDATE doctypes_second_level SET css_style = '#D2B48C' WHERE css_style = 'beige';
|
639
|
UPDATE doctypes_second_level SET css_style = '#0000FF' WHERE css_style = 'blue_style';
|
640
|
UPDATE doctypes_second_level SET css_style = '#0000FF' WHERE css_style = 'blue_style_big';
|
641
|
UPDATE doctypes_second_level SET css_style = '#808080' WHERE css_style = 'grey_style';
|
642
|
UPDATE doctypes_second_level SET css_style = '#FFFF00' WHERE css_style = 'yellow_style';
|
643
|
UPDATE doctypes_second_level SET css_style = '#800000' WHERE css_style = 'brown_style';
|
644
|
UPDATE doctypes_second_level SET css_style = '#000000' WHERE css_style = 'black_style';
|
645
|
UPDATE doctypes_second_level SET css_style = '#000000' WHERE css_style = 'black_style_big';
|
646
|
UPDATE doctypes_second_level SET css_style = '#FF4500' WHERE css_style = 'orange_style';
|
647
|
UPDATE doctypes_second_level SET css_style = '#FF4500' WHERE css_style = 'orange_style_big';
|
648
|
UPDATE doctypes_second_level SET css_style = '#FF00FF' WHERE css_style = 'pink_style';
|
649
|
UPDATE doctypes_second_level SET css_style = '#FF0000' WHERE css_style = 'red_style';
|
650
|
UPDATE doctypes_second_level SET css_style = '#008000' WHERE css_style = 'green_style';
|
651
|
UPDATE doctypes_second_level SET css_style = '#800080' WHERE css_style = 'violet_style';
|
652
|
UPDATE doctypes_second_level SET css_style = '#000000' WHERE css_style = 'default_style';
|
653
|
|
654
|
|
655
|
|
656
|
|
657
|
|
658
|
|
659
|
|
660
|
|
661
|
|
662
|
|
663
|
|
664
|
|
665
|
|
666
|
|
667
|
|
668
|
|
669
|
|
670
|
|
671
|
|
672
|
|
673
|
|
674
|
|
675
|
|
676
|
|
677
|
|
678
|
|
679
|
|
680
|
|
681
|
|
682
|
UPDATE usergroup_content SET primary_group = 'Y';
|
683
|
|
684
|
DO $$ BEGIN
|
685
|
IF (SELECT count(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'user_baskets_secondary') = 1 THEN
|
686
|
DROP TABLE IF EXISTS users_baskets_preferences;
|
687
|
CREATE TABLE users_baskets_preferences
|
688
|
(
|
689
|
id serial NOT NULL,
|
690
|
user_serial_id integer NOT NULL,
|
691
|
group_serial_id integer NOT NULL,
|
692
|
basket_id character varying(32) NOT NULL,
|
693
|
display boolean NOT NULL,
|
694
|
color character varying(16),
|
695
|
CONSTRAINT users_baskets_preferences_pkey PRIMARY KEY (id)
|
696
|
|
697
|
)
|
698
|
WITH (OIDS=FALSE);
|
699
|
INSERT INTO users_baskets_preferences (user_serial_id, group_serial_id, basket_id, display)
|
700
|
SELECT users.id, usergroups.id, groupbasket.basket_id, TRUE FROM users, usergroups, groupbasket, usergroup_content
|
701
|
WHERE usergroup_content.primary_group = 'Y' AND groupbasket.group_id = usergroup_content.group_id AND users.user_id = usergroup_content.user_id AND usergroups.group_id = usergroup_content.group_id
|
702
|
ORDER BY users.id;
|
703
|
DELETE FROM users_baskets_preferences a USING users_baskets_preferences b where a.id > b.id
|
704
|
AND a.user_serial_id = b.user_serial_id
|
705
|
AND a.group_serial_id = b.group_serial_id
|
706
|
AND a.basket_id = b.basket_id;
|
707
|
insert into users_baskets_preferences (user_serial_id, group_serial_id, basket_id, display)
|
708
|
select users.id, usergroups.id, user_baskets_secondary.basket_id, TRUE from users, usergroups, user_baskets_secondary
|
709
|
where users.user_id = user_baskets_secondary.user_id and usergroups.group_id = user_baskets_secondary.group_id
|
710
|
order by users.id;
|
711
|
DELETE FROM users_baskets_preferences a USING users_baskets_preferences b where a.id > b.id
|
712
|
AND a.user_serial_id = b.user_serial_id
|
713
|
AND a.group_serial_id = b.group_serial_id
|
714
|
AND a.basket_id = b.basket_id;
|
715
|
Alter Table users_baskets_preferences add constraint users_baskets_preferences_key UNIQUE (user_serial_id, group_serial_id, basket_id);
|
716
|
DROP TABLE IF EXISTS user_baskets_secondary;
|
717
|
END IF;
|
718
|
END$$;
|
719
|
|
720
|
|
721
|
|
722
|
|
723
|
ALTER TABLE unit_identifier DROP COLUMN IF EXISTS disposition;
|
724
|
ALTER TABLE unit_identifier ADD disposition text default NULL;
|
725
|
|
726
|
ALTER TABLE sendmail DROP COLUMN IF EXISTS message_exchange_id;
|
727
|
ALTER TABLE sendmail ADD message_exchange_id text default NULL;
|
728
|
|
729
|
ALTER TABLE IF EXISTS seda RENAME TO message_exchange;
|
730
|
|
731
|
ALTER TABLE message_exchange DROP COLUMN IF EXISTS file_path;
|
732
|
ALTER TABLE message_exchange ADD file_path text default NULL;
|
733
|
|
734
|
ALTER TABLE message_exchange DROP COLUMN IF EXISTS res_id_master;
|
735
|
ALTER TABLE message_exchange ADD res_id_master numeric default NULL;
|
736
|
|
737
|
|
738
|
ALTER TABLE contact_addresses DROP COLUMN IF EXISTS external_contact_id;
|
739
|
ALTER TABLE contact_addresses ADD COLUMN external_contact_id character varying(128);
|
740
|
|
741
|
ALTER TABLE contact_addresses DROP COLUMN IF EXISTS ban_id;
|
742
|
ALTER TABLE contact_addresses ADD COLUMN ban_id character varying(128);
|
743
|
|
744
|
|
745
|
ALTER TABLE contacts_v2 DROP COLUMN IF EXISTS is_external_contact;
|
746
|
ALTER TABLE contacts_v2 ADD COLUMN is_external_contact character(1) DEFAULT 'N';
|
747
|
|
748
|
DROP SEQUENCE IF EXISTS contact_communication_id_seq CASCADE;
|
749
|
CREATE SEQUENCE contact_communication_id_seq
|
750
|
INCREMENT 1
|
751
|
MINVALUE 1
|
752
|
MAXVALUE 9223372036854775807
|
753
|
START 1
|
754
|
CACHE 1;
|
755
|
|
756
|
DROP TABLE IF EXISTS contact_communication;
|
757
|
CREATE TABLE contact_communication
|
758
|
(
|
759
|
id bigint NOT NULL DEFAULT nextval('contact_communication_id_seq'::regclass),
|
760
|
contact_id bigint NOT NULL,
|
761
|
type character varying(255) NOT NULL,
|
762
|
value character varying(255) NOT NULL,
|
763
|
CONSTRAINT contact_communication_pkey PRIMARY KEY (id)
|
764
|
) WITH (OIDS=FALSE);
|
765
|
|
766
|
DROP VIEW IF EXISTS view_contacts;
|
767
|
CREATE OR REPLACE VIEW view_contacts AS
|
768
|
SELECT c.contact_id, c.contact_type, c.is_corporate_person, c.society, c.society_short, c.firstname AS contact_firstname
|
769
|
, c.lastname AS contact_lastname, c.title AS contact_title, c.function AS contact_function, c.other_data AS contact_other_data
|
770
|
, c.user_id AS contact_user_id, c.entity_id AS contact_entity_id, c.creation_date, c.update_date, c.enabled AS contact_enabled, ca.id AS ca_id
|
771
|
, ca.contact_purpose_id, ca.departement, ca.firstname, ca.lastname, ca.title, ca.function, ca.occupancy
|
772
|
, ca.address_num, ca.address_street, ca.address_complement, ca.address_town, ca.address_postal_code, ca.address_country
|
773
|
, ca.phone, ca.email, ca.website, ca.salutation_header, ca.salutation_footer, ca.other_data, ca.user_id, ca.entity_id, ca.is_private, ca.enabled, ca.external_contact_id
|
774
|
, ca.ban_id, cp.label as contact_purpose_label, ct.label as contact_type_label
|
775
|
FROM contacts_v2 c
|
776
|
RIGHT JOIN contact_addresses ca ON c.contact_id = ca.contact_id
|
777
|
LEFT JOIN contact_purposes cp ON ca.contact_purpose_id = cp.id
|
778
|
LEFT JOIN contact_types ct ON c.contact_type = ct.id;
|
779
|
|
780
|
ALTER TABLE sendmail DROP COLUMN IF EXISTS res_version_att_id_list;
|
781
|
ALTER TABLE sendmail ADD COLUMN res_version_att_id_list character varying(255);
|
782
|
|
783
|
ALTER TABLE message_exchange DROP COLUMN IF EXISTS docserver_id;
|
784
|
ALTER TABLE message_exchange ADD docserver_id character varying(32) DEFAULT NULL;
|
785
|
|
786
|
ALTER TABLE message_exchange DROP COLUMN IF EXISTS path;
|
787
|
ALTER TABLE message_exchange ADD path character varying(255) DEFAULT NULL;
|
788
|
|
789
|
ALTER TABLE message_exchange DROP COLUMN IF EXISTS filename;
|
790
|
ALTER TABLE message_exchange ADD filename character varying(255) DEFAULT NULL;
|
791
|
|
792
|
ALTER TABLE message_exchange DROP COLUMN IF EXISTS fingerprint;
|
793
|
ALTER TABLE message_exchange ADD fingerprint character varying(255) DEFAULT NULL;
|
794
|
|
795
|
ALTER TABLE message_exchange DROP COLUMN IF EXISTS filesize;
|
796
|
ALTER TABLE message_exchange ADD filesize bigint;
|
797
|
|
798
|
DELETE FROM docservers WHERE docserver_id = 'ARCHIVETRANSFER';
|
799
|
INSERT INTO docservers (docserver_id, docserver_type_id, device_label, is_readonly, enabled, size_limit_number, actual_size_number, path_template, ext_docserver_info, chain_before, chain_after, creation_date, closing_date, coll_id, priority_number, docserver_location_id, adr_priority_number)
|
800
|
VALUES ('ARCHIVETRANSFER', 'ARCHIVETRANSFER', 'Fast internal disc bay for archive transfer', 'N', 'Y', 50000000000, 1, '/opt/maarch/docservers/archive_transfer/', NULL, NULL, NULL, '2017-01-13 14:47:49.197164', NULL, 'archive_transfer_coll', 10, 'NANTERRE', 2);
|
801
|
|
802
|
DELETE FROM docserver_types WHERE docserver_type_id = 'ARCHIVETRANSFER';
|
803
|
INSERT INTO docserver_types (docserver_type_id, docserver_type_label, enabled, is_container, container_max_number, is_compressed, compression_mode, is_meta, meta_template, is_logged, log_template, is_signed, fingerprint_mode)
|
804
|
VALUES ('ARCHIVETRANSFER', 'Archive Transfer', 'Y', 'N', 0, 'N', 'NONE', 'N', 'NONE', 'N', 'NONE', 'Y', 'SHA256');
|
805
|
|
806
|
ALTER TABLE sendmail ALTER COLUMN res_id DROP NOT NULL;
|
807
|
|
808
|
ALTER TABLE notifications DROP COLUMN IF EXISTS rss_url_template;
|
809
|
UPDATE notifications SET event_id = 'baskets' WHERE notification_id = 'BASKETS';
|
810
|
|
811
|
DELETE FROM parameters where id = 'user_quota';
|
812
|
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('user_quota', '', 0, NULL);
|
813
|
DELETE FROM parameters where id = 'database_version';
|
814
|
INSERT INTO parameters (id, param_value_string, param_value_int, param_value_date) VALUES ('database_version', '18.04.10', NULL, NULL);
|
815
|
|
816
|
INSERT INTO templates_doctype_ext SELECT null, d.type_id, 'N' FROM doctypes d LEFT JOIN templates_doctype_ext tde ON d.type_id = tde.type_id WHERE tde.type_id IS NULL;
|
817
|
|
818
|
UPDATE status set img_filename = 'fm-letter' where img_filename is null or img_filename = '';
|
819
|
|
820
|
DELETE FROM usergroups_services WHERE service_id in ('delete_document_in_detail', 'edit_document_in_detail');
|
821
|
INSERT INTO usergroups_services (group_id, service_id)
|
822
|
SELECT group_id, 'delete_document_in_detail' FROM security WHERE rights_bitmask IN (16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31);
|
823
|
|
824
|
INSERT INTO usergroups_services (group_id, service_id)
|
825
|
SELECT group_id, 'edit_document_in_detail' FROM security WHERE rights_bitmask IN (8,9,10,11,12,13,14,15,24,25,26,27,28,29,30,31);
|