deluan / contentful-migrate

🐎 Schema migration tooling for Contentful, with state management
https://www.contentful.com/blog/2018/09/13/content-model-changes-scale-telus-cms-as-code/
MIT License
60 stars 37 forks source link

Bug when adding `defaultValue` to a field and widget to the sidebar #259

Open gjorgji-dept opened 2 years ago

gjorgji-dept commented 2 years ago

Hi,

Running migrations with this package throws errors and causes bugs that started a couple of days ago. Namely, doing this

const model = migration.editContentType("contentTypeId");

model.createField("fieldId")
  .name("Field name")
  .type("Integer")
  .defaultValue({
    [locale]: value,
  })

causes scripts to fail with the following error: "defaultValue" is not a valid property name for a field.

When adding a widget to the sidebar with the following code, it adds the widget, but it removes all of the other (native) widgets

const model = migration.editContentType("contentTypeId");

model.addSidebarWidget(
  "app",
  "widgetId",
  {},
  "publication-widget"
);

Using the native contentful-migration package it executes both scripts without any issues, but when using ctf-migrate to do the migrations, the aforementioned bugs and errors occur.

Package versions: "contentful": "^9.1.18", "contentful-migrate": "^0.16.0", "contentful-cli": "^1.12.8", "contentful-migration": "^4.0.0"

Updating the packages still doesn't resolve the issue and if anything, it further breaks the whole set up. I appreciate any help resolving this issue.

P.S. #224 might be the reason why it started failing only recently.

Thanks!