Skip to content
Snippets Groups Projects
Verified Commit 449f6fdb authored by Damien's avatar Damien
Browse files

FEAT #11691 TIME 0:45 Remove useless attachments columns

parent 088c842a
No related branches found
No related tags found
No related merge requests found
...@@ -529,6 +529,21 @@ ALTER TABLE listinstance DROP COLUMN IF EXISTS visible; ...@@ -529,6 +529,21 @@ ALTER TABLE listinstance DROP COLUMN IF EXISTS visible;
ALTER TABLE listinstance_history_details DROP COLUMN IF EXISTS added_by_entity; ALTER TABLE listinstance_history_details DROP COLUMN IF EXISTS added_by_entity;
ALTER TABLE usergroup_content DROP COLUMN IF EXISTS primary_group; ALTER TABLE usergroup_content DROP COLUMN IF EXISTS primary_group;
ALTER TABLE emails ALTER COLUMN document type jsonb; ALTER TABLE emails ALTER COLUMN document type jsonb;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS subject;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS description;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS type_id;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS author;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS source;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS folders_system_id;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS offset_doc;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS destination;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS priotity;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS initiator;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS is_multicontacts;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS is_multi_docservers;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS tnl_path;
ALTER TABLE res_attachments DROP COLUMN IF EXISTS tnl_filename;
/* M2M */ /* M2M */
DO $$ BEGIN DO $$ BEGIN
......
...@@ -247,31 +247,22 @@ CREATE TABLE res_attachments ...@@ -247,31 +247,22 @@ CREATE TABLE res_attachments
( (
res_id bigint NOT NULL DEFAULT nextval('res_attachment_res_id_seq'::regclass), res_id bigint NOT NULL DEFAULT nextval('res_attachment_res_id_seq'::regclass),
title character varying(255) DEFAULT NULL::character varying, title character varying(255) DEFAULT NULL::character varying,
subject text,
description text,
type_id bigint ,
format character varying(50) NOT NULL, format character varying(50) NOT NULL,
typist character varying(128) NOT NULL, typist character varying(128) NOT NULL,
creation_date timestamp without time zone NOT NULL, creation_date timestamp without time zone NOT NULL,
modification_date timestamp without time zone DEFAULT NOW(), modification_date timestamp without time zone DEFAULT NOW(),
author character varying(255) DEFAULT NULL::character varying,
identifier character varying(255) DEFAULT NULL::character varying, identifier character varying(255) DEFAULT NULL::character varying,
source character varying(255) DEFAULT NULL::character varying,
relation bigint, relation bigint,
docserver_id character varying(32) NOT NULL, docserver_id character varying(32) NOT NULL,
path character varying(255) DEFAULT NULL::character varying, path character varying(255) DEFAULT NULL::character varying,
filename character varying(255) DEFAULT NULL::character varying, filename character varying(255) DEFAULT NULL::character varying,
offset_doc character varying(255) DEFAULT NULL::character varying,
fingerprint character varying(255) DEFAULT NULL::character varying, fingerprint character varying(255) DEFAULT NULL::character varying,
filesize bigint, filesize bigint,
status character varying(10) DEFAULT NULL::character varying, status character varying(10) DEFAULT NULL::character varying,
destination character varying(50) DEFAULT NULL::character varying,
validation_date timestamp without time zone, validation_date timestamp without time zone,
effective_date timestamp without time zone, effective_date timestamp without time zone,
work_batch bigint, work_batch bigint,
origin character varying(50) DEFAULT NULL::character varying, origin character varying(50) DEFAULT NULL::character varying,
priority character varying(16),
initiator character varying(50) DEFAULT NULL::character varying,
dest_user character varying(128) DEFAULT NULL::character varying, dest_user character varying(128) DEFAULT NULL::character varying,
res_id_master bigint, res_id_master bigint,
origin_id INTEGER, origin_id INTEGER,
...@@ -279,10 +270,6 @@ CREATE TABLE res_attachments ...@@ -279,10 +270,6 @@ CREATE TABLE res_attachments
dest_contact_id bigint, dest_contact_id bigint,
dest_address_id bigint, dest_address_id bigint,
updated_by character varying(128) DEFAULT NULL::character varying, updated_by character varying(128) DEFAULT NULL::character varying,
is_multicontacts character(1),
is_multi_docservers character(1) NOT NULL DEFAULT 'N'::bpchar,
tnl_path character varying(255) DEFAULT NULL::character varying,
tnl_filename character varying(255) DEFAULT NULL::character varying,
in_signature_book boolean DEFAULT FALSE, in_signature_book boolean DEFAULT FALSE,
in_send_attach boolean DEFAULT FALSE, in_send_attach boolean DEFAULT FALSE,
signatory_user_serial_id int, signatory_user_serial_id int,
......
...@@ -830,11 +830,13 @@ class AttachmentController ...@@ -830,11 +830,13 @@ class AttachmentController
if (!Validator::intVal()->notEmpty()->validate($body['originId'])) { if (!Validator::intVal()->notEmpty()->validate($body['originId'])) {
return ['errors' => 'Body originId is not an integer']; return ['errors' => 'Body originId is not an integer'];
} }
$origin = AttachmentModel::getById(['id' => $body['originId'], 'select' => ['res_id_master']]); $origin = AttachmentModel::getById(['id' => $body['originId'], 'select' => ['res_id_master', 'origin_id']]);
if (empty($origin)) { if (empty($origin)) {
return ['errors' => 'Body originId does not exist']; return ['errors' => 'Body originId does not exist'];
} elseif ($origin['res_id_master'] != $body['resIdMaster']) { } elseif ($origin['res_id_master'] != $body['resIdMaster']) {
return ['errors' => 'Body resIdMaster is different from origin']; return ['errors' => 'Body resIdMaster is different from origin'];
} elseif (!empty($origin['origin_id'])) {
return ['errors' => 'Body originId can not be a version, it must be the original version'];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment