Need guidance on removing a field from the schema in an app using

11 replies
Last updated: Feb 8, 2024
Hey all, I have an app that is already being used. There's a field in some of the documents and this field is being removed from our schema now. Is there anything I need to do when it comes to the data that had been added already? Could someone point me to a place in the docs where I can find more information about it? Thanks!
Feb 8, 2024, 3:41 PM
This should help!
Feb 8, 2024, 5:24 PM
That's really helpful! Thanks
user M
Feb 8, 2024, 6:02 PM
I think I celebrated too early πŸ˜„ . I just tested this on my end and it doesn't seem to show anything on a field at least:
title: "Title2",
  name: "title2",
  type: "string",
  deprecated: {
    reason: 'Title2 not used anymore.'
  readOnly: true // to prevent further edits
Even thought it seems to prevent the user from typing, it still allows them to focus on the input and doesn't give any feedback, which doesn't seem to be a good user experience.
Feb 8, 2024, 6:18 PM
What version of the Studio are you on?
Feb 8, 2024, 6:23 PM
Feb 8, 2024, 6:24 PM
Ah yeah, this just shipped this week, so give updating a go.
Feb 8, 2024, 6:24 PM
Ah, got it. I'll keep that in mind then...I'll push for the field removal though, since it's something that is probably more aligned with what the client wants to. Thanks for the help 🀝
Feb 8, 2024, 6:30 PM
If you go that route just repurpose this script.
Feb 8, 2024, 6:32 PM
How does that
associate with my account? I'm getting an insufficient permissions error:
responseBody: '{\n' +
    '  "error": {\n' +
    '    "description": "Mutation failed: Insufficient permissions; permission \\"update\\" required",\n' +
    '    "items": [\n' +
    '      {\n' +
    '        "error": {\n' +
    '          "description": "Insufficient permissions; permission \\"update\\" required",\n' +
    '          "permission": "update",\n' +
    '          "type": "insufficientPermissionsError"\n' +
    '        },\n' +
    '        "index": 0\n' +
    '      }\n' +
    '    ],\n' +
    '    "type": "mutationError"\n' +
    '  }\n' +
I assume I should create a token somewhere to attach it? I'm logged in my organization via sso if it matters.
Feb 8, 2024, 7:19 PM
I managed to fix that by creating a token in the environment and providing that token once I'm creating the client. That works. Thanks!
Feb 8, 2024, 9:24 PM
It could have been that you were logged into a different account in the CLI. Using different providers creates different accounts.
Feb 8, 2024, 10:45 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?