
Hey, I can't see any easy way to version the DB Schema. Lets say I have a production version running, but in development I want to add a new column to a DB.
What I want to happen, is that I can define this in some sort of config or code somewhere, and then I wish that when I PR into my staging branch, I can have my CI/CD migrate the added column to the staging instance of that database within AppWrite.
Then when I PR to main branch, same thing but change the DB to take that new column.
Of course, in this example it may be simple to do it manually, but I want to remove all manual steps from deployment, and the scenario won't always be this trivial of course.
Is there a current method to do this? Is it just using the server SDK, pulilng the DB schema yourself manually, comparing to the desired schema and making the changes with the server SDK? Or is there something more concrete to help handle this already in existance?

For now, the most common approach is to use a script-based scheme, as you've suggested.
Also, it's good to know that Appwrite supports fetching (init collections
) and deploying collection data using Appwrite CLI.
To test it, you can just run these commands after you've logged in.
appwrite login
appwrite init project
appwrite init databases
appwrite init collections
Than, you can deploy them in a different instances / projects
appwrite deploy collections
Check more about it here: https://appwrite.io/docs/tooling/command-line/commands#examples

Hmm, so taking a breif look at the CLI stuff you linked to (thank you!), I could version control the appwrite.json file, and ensure that before PRing from dev to staging that the appwrite.json file has been init'ed correctly with my DB schema, then in my CI/CD, deploy said schema from the appwrite.json file to the staging instance & project?

Ah no, becuase it will overwrite the DB data

Yes. Exactly
Just one thing, I'm not sure about updating an existing one in your production environment, as I've never tried it so it would be best to just test

It shouldn't delete existing data

It seems to suggest that here.

Good to know 👍

So only for staging and testing

So a good way would be a mix

I'm early in project, I don't have any prod environment right now so loss of data right this minute is fine, can't make any mistakes that cost me - but I am looking to build something out that won't lose my data of course - but testing stuff and playing about now is all good at least 🙂
Recommended threads
- Permission issue on the server
I'm setting document permissions on the server when creating a document using Appwrite. I’m using Permission.read(Role.user(userId)) to allow a specific user ac...
- Relationships
At the moment I don't need support on this as I have a work around for it. Problem : existing relationships can not be edited. Instance: self hosted Docker on ...
- unable to access the appwrite console
i havev a self hosted appwrite instance on a vps. appwrite seems to be working fine. all applications and websites are functional seems to ve getting data form ...
