Back

Database updates

  • 0
  • Databases
mtj01
3 Oct, 2024, 22:18

Hi

Regarding updating database, like collections and stuff

Let's say I have a cloud function that creates a database and some collections with their attributes.

Later on, if I want to add additional attributes to the collection, programatically via the same cloud function, and I add additional code to create an attribute in existing collection, will the function go and create another db, collections, etc, or just update existing thing?

If it will not just updat the existing thing, can you suggest some proper way of handling this?

TL;DR
Developers are discussing how to handle database updates efficiently in Appwrite. They want to know if Appwrite can handle updates to existing database structures without recreating them. They mention frameworks like Laravel and AWS that can handle this. The developers are looking for a way to avoid multiple `if exists` checks when updating database collections and attributes. Possible Solution: - Appwrite does not support automatic database updates with new attributes on existing collections. It is suggested to manually handle these updates without creating duplicate resources.
Steven
3 Oct, 2024, 22:20

depends on how you write your code 🧐

mtj01
3 Oct, 2024, 22:21

Well I would like to avoid bunch of if exists checks

mtj01
3 Oct, 2024, 22:24

I was just wondering if those are already built in so we don't have to write bunch of checks. So only newly added things are being ran and updated while existing stuff is intact (and not recreated, deleted, etc).

Some frameworks and clouds already handle that. I think Laravel handled it a long time ago.

And AWS stacks files also handle infrastructure in that way. Like if you define database, tables and other infrastructure, it creates it first time it runs. When you add additions to it or changes, it only runs those additions/changes against existing resources.

mtj01
3 Oct, 2024, 22:25

It would be nice if appwrite would handle project infrastructure / resources in that way too. Sometime in the future at least, if nothing like that is present now. :)=

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