Back

[SOLVED] Deploying collection updates without losing data

  • 0
  • Databases
jordorama
4 Mar, 2023, 15:51

Hi,

Im trying to update my databases from the CLI. I did a test with one of my dev databases and my data all became n/a.

What I did was pull the latest collection with appwrite init collection then push it back up to the same DB. There were no changes to the structure but the data seems to be gone.

The documents are there but everything is n/a

Is there a way to deploy a collection without loosing data?

TL;DR
The user experienced data loss when trying to deploy collection updates using the Appwrite CLI. It was discovered that the CLI wipes and redeploys attributes and indexes, causing data loss. The solution is to create scripts using a server SDK instead of using the CLI for making changes after going to production.
jordorama
4 Mar, 2023, 16:13

Deploying collection updates without losing data

Drake
4 Mar, 2023, 19:20

Yes, that's expected with the CLI at the moment because the attributes and indexes get wiped and then redeployed. There should be a warning about data loss when deploying.

If you're going to make changes after going to prod, you might want to create scripts using a server SDK

jordorama
5 Mar, 2023, 00:51

Ah yea. It said you "may" lose data which I assumed would be the case if we changed or removed database attributes. All good though. Thanks 🤙

Drake
7 Mar, 2023, 19:43

[SOLVED] Deploying collection updates without losing data

skavank
19 Jul, 2023, 19:03

I just did this and blew up my collections. The docs (https://appwrite.io/docs/command-line-deployment#deployCollections) say "The Appwrite CLI also helps you migrate your project's databases and collections from a development server to a production server." I guess that's technically not true since it will wipe your entire production server 😅

Drake
19 Jul, 2023, 19:07

it works for the 1st migration 😜

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more