migration-scripts icon indicating copy to clipboard operation
migration-scripts copied to clipboard

Some fields of some Content-types are displayed twice in Content Manager after running Migration-scripts

Open lrasata opened this issue 1 year ago • 3 comments

Bug report

Required System information

  • Node.js version: v14.19.3
  • NPM version: v6.14.17
  • Source Strapi version: v3.6.6
  • Target Strapi version: v4.5.6
  • Source Database: Postgres
  • Target Database: Postgres
  • Operating system: macOS
  • Which script are you running: v3-sql-v4-sql

Describe the bug

After running migration-scripts, when consulting the details of one entry, some fields appears twice. Below for example for the Content-type : News-type, the field : 'type' appears twice Screenshot 2023-02-08 at 9 27 31 AM

When the schema.json of News-type is :

  "kind": "collectionType",
  "collectionName": "news_types",
  "info": {
    "singularName": "news-type",
    "pluralName": "news-types",
    "displayName": "News-type",
    "name": "news-type"
  },
  "options": {
    "increments": true,
    "timestamps": true,
    "draftAndPublish": true
  },
  "pluginOptions": {
    "i18n": {
      "localized": true
    }
  },
  "attributes": {
    "type": {
      "type": "string",
      "required": true,
      "pluginOptions": {
        "i18n": {
          "localized": true
        }
      }
    }
  }
}

I also checked the database and there is no double column 'type'. So it is just a problem in the view. See below, we have the Config view edit and the field 'type' appears twice for some reason. Screenshot 2023-02-08 at 9 31 17 AM

Interestingly the 2 other Content-types which are linked to News-type have some problem in their view as well : Latest-news-and-resource

{
  "kind": "collectionType",
  "collectionName": "news_and_resources",
  "info": {
    "singularName": "latest-news-and-resource",
    "pluralName": "latest-news-and-resources",
    "displayName": "Latest-news-and-resource",
    "name": "latest-news-and-resource",
    "description": ""
  },
  ...
  "attributes": {
    "title": {
      "type": "string",
      "required": true,
      "pluginOptions": {
        "i18n": {
          "localized": true
        }
      }
    },
    ...
    "news_type": {
      "type": "relation",
      "relation": "oneToOne",
      "target": "api::news-type.news-type"
    },
    "primary_category": {
      "type": "relation",
      "relation": "manyToOne",
      "target": "api::category.category",
      "inversedBy": "primary_category_news_and_resources"
    },
    "other_categories": {
      "type": "relation",
      "relation": "manyToMany",
      "target": "api::category.category",
      "inversedBy": "other_categories_news_and_resources"
    },
    ...
    }
  }
}

For Latest-news-and-resources, the fields : news-type, primary_category, other_categories . All appear twice as in the image below : Screenshot 2023-02-08 at 9 32 27 AM

And it is the same for Category :

{
  "kind": "collectionType",
  "collectionName": "categories",
  "info": {
    "singularName": "category",
    "pluralName": "categories",
    "displayName": "Category",
    "name": "category"
  },
  "options": {
    "increments": true,
    "timestamps": true,
    "draftAndPublish": true
  },
  "pluginOptions": {
    "i18n": {
      "localized": true
    }
  },
  "attributes": {
    "name": {
      "type": "string",
      "required": true,
      "pluginOptions": {
        "i18n": {
          "localized": true
        }
      }
    },
    "primary_category_news_and_resources": {
      "type": "relation",
      "relation": "oneToMany",
      "target": "api::latest-news-and-resource.latest-news-and-resource",
      "mappedBy": "primary_category"
    },
    "other_categories_news_and_resources": {
      "type": "relation",
      "relation": "manyToMany",
      "target": "api::latest-news-and-resource.latest-news-and-resource",
      "mappedBy": "other_categories"
    }
  }
}

Screenshot 2023-02-08 at 9 37 33 AM

It looks like this problem only appear for Content-types which have '-' hyphen in the name and is linked to other Content-types. Once again the database and the model files are all fine, it is just in the view.

Steps to reproduce the behavior

  1. Run migration-scripts : v3-sql-v4-sql with some Collection-types with '-' in the name and link them to Content-type with a relation
  2. All data are fully migrated
  3. Go to 'Content-Manager' of view the detail of one entry
  4. See that some fields are displayed twice

Expected behavior

No fields should be displayed twice.

Additional context

The duplicated field through the Config view edit of the Content Manager. But we would like to avoid any manual action because we aren't necessarily aware where this may appear and we aren't sure if it will appear again.

lrasata avatar Feb 07 '23 20:02 lrasata