management-sdk icon indicating copy to clipboard operation
management-sdk copied to clipboard

Cannot update a field to be required once already created

Open joelpierre opened this issue 4 years ago • 6 comments

I have a model with a simple field I created. In the next migration I wanted to make this field required, however the update was being rejected, even though I was passing a migration value.

When testing I noticed that I had to delete every entry and then I could update the field to be required.

In the UI this isn't an issue as it asks for a migration value. I assume there is some sort of ordering of mutations issue meaning that the migration is rejected?

e.g

model.addSimpleField({
  apiId: 'label',
  displayName: 'Label',
  type: FieldType.String,
  isLocalized: true
});

on next run when content has been added (this fails)

model.updateSimpleField({
  apiId: 'label',
  migrationValue: 'test',
  isRequired: true
});

joelpierre avatar Jul 12 '21 09:07 joelpierre

Internal Issue: ENG-3642

notrab avatar Jul 12 '21 10:07 notrab

Just wanted to drop a word here saying this is still relevant today.

The migration gets rejected with 'FAILED Could not apply schema changes'

NicolasBiehler avatar Oct 01 '21 14:10 NicolasBiehler

@notrab - was there any movement on this one? Could it be solved by your draft PR https://github.com/GraphCMS/management-sdk/pull/20 ?

joelpierre avatar Jan 27 '22 23:01 joelpierre

@joelpierre this should be resolved now, right?

notrab avatar Mar 18 '22 12:03 notrab

@joelpierre this should be resolved now, right?

I am not sure haven't re-checked since Jan. I just generally avoid it 😅

joelpierre avatar Mar 18 '22 19:03 joelpierre

Hello any update on this issue? I am having similar issue, trying to do upsert to a model based on the apiId

hananabud avatar Aug 30 '23 15:08 hananabud