Upgrading Sanity from V1 to V3 without losing data - is it possible?

13 replies
Last updated: Feb 17, 2023
Hi - I two environments that appear to be quite dated and require updating. Upon running
sanity upgrade
, none of the packages update and I'm given a URL of
<https://www.sanity.io/changelog/studio?from=v1&to=v2>
which 404's.
With research, I see that sanity is now on V3. The 2 sites really aren't that old so I'm a little shocked at how outdated they already are.
After a bit of googling, I can find details on how to upgrade from V2 to V3, but nothing mentioning V1.

Does anyone know if its possible to go from V1 to V3 without losing any data in the datasets and what changes I would have to make around the schema (is the documentation for V2-&gt;V3 still relevant to me)?
AI Update

Good news - your data in the Content Lake is completely safe and separate from your Studio version. Upgrading Studio versions won't affect your content at all, so there's no risk of data loss.

However, you're right that jumping from v1 to v3 is a significant leap. Here's what you need to know:

The Migration Path

Since you're on Studio v1, you'll essentially need to go through two major migrations. The good news from this community thread is that v1 to v2 had minimal breaking changes - you can actually skip directly to v3 if you follow the migration guides.

The reality is that the v2 to v3 migration guidance will be directly relevant to you, though you may encounter some v1-specific patterns that need updating first.

Key Changes Across Versions

Studio v1 → v2:

  • Minimal breaking changes (mostly internal)
  • Both used sanity.json configuration
  • Parts System updates

Studio v2 → v3 (the bigger architectural shift):

  • sanity.jsonsanity.config.js/ts (JavaScript-based config)
  • Parts System completely removed → new plugin API
  • Webpack → Vite build system
  • Full TypeScript support
  • ESM modules required
  • defineType and defineField wrappers for schemas

Based on the community experience, the fastest and cleanest approach is:

  1. Initialize a fresh v3 Studio using npm create sanity@latest
  2. Copy over your schema files to the new project structure
  3. Add your existing project ID and dataset name to sanity.config.js and sanity.cli.js
  4. Update schema syntax to use v3 patterns (mainly adding defineType/defineField wrappers)

If you don't have custom input components or complex plugins, this can take as little as 10-15 minutes!

Schema Considerations

Your schema structure (document types, fields, validation) remains conceptually the same, but the syntax changes slightly:

v2/v1 style:

export default {
  name: 'post',
  type: 'document',
  fields: [...]
}

v3 style:

import {defineType, defineField} from 'sanity'

export default defineType({
  name: 'post',
  type: 'document',
  fields: [...]
})

Important Notes

  • Studio v2 support ended December 7, 2023, so you should prioritize this upgrade
  • The sanity upgrade command doesn't work for major version jumps - that's why you're seeing the 404
  • Your data remains completely safe in the Content Lake throughout this process
  • If you hit dependency issues (like RxJS errors), the fresh install approach typically resolves them

Why the Fresh Install Works Better

Community members found that trying to upgrade in-place often caused dependency conflicts that were hard to resolve. Starting fresh with npm create sanity@latest and migrating your schemas over avoids these issues entirely - the new project gets all the correct dependencies from the start.

Your data is safe, and once you're on v3 (or now v4, which is the current version), the platform is much more stable and modern. The migration effort is worth it!

Show original thread
13 replies
If you’re still on V1, it sounds like it’s been at least 2 years since your projects were created! V1-V2 is the easiest of the two upgrades. I don’t believe there are any breaking changes between the two. You can go directly to V3 if you follow the migration guides.
You should note that any Studio migrations would have no effect on your data. Datasets exist separately from the Studio UI.
Thanks for the reply
user M
- so the studio changes for V3 still follow the same dataset structure, just achieved a different way via the code base is what I’m hearing - is that fair to say?
Is there any point or make it any easier to upgrade to V2 first, or makes no difference?
You’re exactly right! Going to V2 wouldn’t actually require any schema or config changes, if I recall correctly, so it won’t make the migration any easier doing that first. If you’re not in a place where you can do the full migration to V3, you could get away with upgrading to V2 then circling back for the final migration before the end of the year.
Ok great - and the migration is mainly just including the schema differently in the project, from what I gather (different file structure, includes, etc)?
If you don’t have any custom input components, you can basically init a new Studio, then just copy over your schema files and add your old project id and dataset names into
sanity.config.js
and
sanity.cli.js
. It’ll take you about 10 mins! The time consuming parts are the custom input components and plugins.
Oh - interesting! I’ll have to revisit and review the projects in question as to whether I have custom inputs… I have a feeling I don’t so that’s very good to know.
I’ll give this a go and see what happens. Thanks so much for your help and info provided!
So, I'm following the step by step guide on the site, and on the first run attempt, I'm getting errors from RXJS that modules
tap
,
switchMap
and
concatMap
are not found.
I see its been a bit of a running theme from a quick search here in slack. I've attempted the ol' "delete node_modules and reinstall", no luck unfortunately
Tried the downgrade stated on this thread and it got me a little further, instead got this:
attempted a clean node_modules folder again, still no good.I've carried out the remainder of the guide as well. Seems I've hit a roadblock?
Strangely, ran
sanity init
in a new folder, which installed V3, and it worked. I noticed that it ran
npm install --legacy-peer-deps
so I removed the node_modules from my original folder and tried that - still no good.
Though, I just reread your messages and you stated to init a new project
🤦 so i'll transfer over the files I created and see how I go.
Stuffed if I know what the issue was in trying to migrate from the existing project, but seems to have worked completely fine from a fresh one and bringing everything over.
Apologies for the string of messages - if anything, hopefully it has something in here that you may not have already been aware of.

Thanks again for your help!
Thanks for taking us through your journey! This is all useful information!

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?