diff --git a/migration/20.10/2010.sql b/migration/20.10/2010.sql index 13d542339cfacb144ed0892b29ef083983986158..a0d15742fa4dc89f6849827f5f7c5402acfc8809 100755 --- a/migration/20.10/2010.sql +++ b/migration/20.10/2010.sql @@ -298,7 +298,7 @@ UPDATE res_attachments SET attachment_type = 'reply_record_management' WHERE att ALTER TABLE custom_fields DROP COLUMN IF EXISTS mode; DROP TYPE IF EXISTS custom_fields_modes; CREATE TYPE custom_fields_modes AS ENUM ('form', 'technical'); -ALTER TABLE custom_fields ADD COLUMN mode custom_fields_modes DEFAULT 'form'; +ALTER TABLE custom_fields ADD COLUMN mode custom_fields_modes NOT NULL DEFAULT 'form'; /* RE CREATE VIEWS */ CREATE OR REPLACE VIEW res_view_letterbox AS diff --git a/sql/structure.sql b/sql/structure.sql index 019eef42b067658f114813963f9d59c3781e8be3..49d128b5e6f6d7da9fe8ab109f3f7c1e47d76482 100755 --- a/sql/structure.sql +++ b/sql/structure.sql @@ -1314,11 +1314,14 @@ CONSTRAINT acknowledgement_receipts_pkey PRIMARY KEY (id) ) WITH (OIDS=FALSE); +CREATE TYPE custom_fields_modes AS ENUM ('form', 'technical'); + CREATE TABLE custom_fields ( id serial NOT NULL, label character varying(256) NOT NULL, type character varying(256) NOT NULL, + mode custom_fields_modes NOT NULL DEFAULT 'form', values jsonb, CONSTRAINT custom_fields_pkey PRIMARY KEY (id), CONSTRAINT custom_fields_unique_key UNIQUE (label) diff --git a/test/unitTests/app/customField/CustomFieldControllerTest.php b/test/unitTests/app/customField/CustomFieldControllerTest.php index 6dead37c9b172e9a36e191f651334f787b896067..3ba2cef0670823899d312ee2cf9e6cf291dfeba5 100644 --- a/test/unitTests/app/customField/CustomFieldControllerTest.php +++ b/test/unitTests/app/customField/CustomFieldControllerTest.php @@ -24,6 +24,7 @@ class CustomFieldControllerTest extends TestCase $args = [ 'label' => 'mon custom', 'type' => 'select', + 'mode' => 'form', 'values' => ['one', 'two'] ]; $fullRequest = \httpRequestCustom::addContentInBody($args, $request); @@ -43,6 +44,7 @@ class CustomFieldControllerTest extends TestCase $args = [ 'label' => 'mon custom', 'type' => 'select', + 'mode' => 'form', 'values' => ['one', 'two'] ]; $fullRequest = \httpRequestCustom::addContentInBody($args, $request); @@ -76,6 +78,7 @@ class CustomFieldControllerTest extends TestCase $args = [ 'label' => 'mon custom22', + 'mode' => 'form', 'values' => ['one', 'two', 'trois'] ]; $fullRequest = \httpRequestCustom::addContentInBody($args, $request);