dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
865 stars 467 forks source link

CLI content type does not correctly set baseType #30438

Closed wezell closed 1 week ago

wezell commented 3 weeks ago

Problem Statement

If you use the CLI to download content types and then push those content types to another server, it does not correctly respect the base content type and makes everything just "CONTENT"

Doing this will blow up content types that already exist, e.g. htmlPageAsset and FileAsset.

This basically makes it impossible to bootstrap an instance with content types.

Steps to Reproduce

pull a non-content content type from one instance and then push it to another instance. The newly created content type will be created with the "content" base type.

Acceptance Criteria

This should work correctly.

dotCMS Version

24.10

Proposed Objective

Technical User Experience

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

jgambarios commented 2 weeks ago

I'm not sure if these changes (made by me) are part or the cause of the problem https://github.com/dotCMS/core/commit/52d32991c47b7af2113c5ff8640fda7f5b316f5f#diff-1d2415ce4ef024554ffe53ac00279a458241d1fce2db1ae2ed0887de55998bb2L88

If the link don't take you to the fragment of code I think is the problem, this is the PR: https://github.com/dotCMS/core/pull/29579 and the problem could be related to the removed code in tools/dotcms-cli/api-data-model/src/main/java/com/dotcms/model/contenttype/AbstractSaveContentTypeRequest.java specifically the removal of:

        public SaveContentTypeRequest.Builder of(ContentType in) {
            this.typeInf = in.getClass();
            return from(in);
        }

I haven't confirmed it is the cause, but, it is worth to take a look.

github-actions[bot] commented 2 weeks ago

PRs:

dcolina commented 1 week ago

Internal QA: Passed.

The task has successfully passed all quality assurance tests, following a detailed and structured testing process. The steps executed to validate the functionality are outlined below.

Steps Taken

  1. Environment Setup:

    • A local instance of dotCMS was launched using the Docker image dotcms/dotcms:trunk_70b861a.
  2. Initial Data Verification:

    • Connected to the local database to list a Non-Content item (Image) and verified its attributes, confirming that the structuretype was set as FILEASSET.
    • The following SQL query was used to check the data:
      SELECT
       s.inode,
       s.name,
       temp_table.type,
       s.mod_date
      FROM
       structure s
           JOIN
       (VALUES
            (1, 'CONTENT'),
            (2, 'WIDGET'),
            (3, 'FORM'),
            (4, 'FILEASSET'),
            (5, 'HTMLPAGE'),
            (6, 'PERSONA')
       ) AS temp_table(id, type)
       ON
           s.structuretype = temp_table.id
      WHERE s.name = 'Image';

Note: ENUM https://github.com/dotCMS/core/blob/a0908219bffa1e4b75ad5dbcda7fdca234b68cb5/dotCM[…]n/java/com/dotmarketing/portlets/structure/model/Structure.java

Image

  1. Content Type (CT) Modification:
    • Modified the Content Type (CT) Image.
    • Logged in using dotcli and pushed the modified CT Image.

Image

  1. Post-Modification Validation:
    • Reconnected to the local database to review the attributes of the Image.
    • Used the same SQL query to confirm that the structuretype attribute remained unchanged and was still FILEASSET, validating that the push process did not affect this attribute.

Image

Environment Details