sdk-for-cli icon indicating copy to clipboard operation
sdk-for-cli copied to clipboard

🐛 Bug Report: Deploy collection does not maintain the order of the attributes defined in the Appwrite.json file

Open wiandrea opened this issue 1 year ago • 4 comments

👟 Reproduction steps

run appwrite deploy collection command

👍 Expected behavior

The order of the defined attributes of the appwrite.json file must be maintained when deployed

👎 Actual Behavior

does not maintain the order of the attributes defined in the appwrite.json file they are sorted randomly

🎲 Appwrite version

Version 1.3.x

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

wiandrea avatar Apr 17 '23 16:04 wiandrea

Hi, thanks for opening this issue.

I'm curious, why do you need the order of attributes to be retained?

This should not make any difference in practice.

gewenyu99 avatar Jun 24 '23 16:06 gewenyu99

Hi, thanks for opening this issue.

I'm curious, why do you need the order of attributes to be retained?

This should not make any difference in practice.

Sure but sometimes we want (rather than need) to have things clean to read, grouping attribs by feature/meaning, having most important attribs at the start and so on. It's not because we don't need it that we don't want it :-)

BigPapoo avatar Jan 06 '24 23:01 BigPapoo

Hmmm we could try to change how we create the collections and attributes:

  1. Create all collections concurrently
  2. Concurrently for each collection, create all attributes sequentially
  3. Wait for all attributes concurrently

If we create all collections first, we shouldn't run into any problems with relationship attributes.

Theoretically, the create attribute API call should return quickly because the actual creation is asynchronous.

stnguyen90 avatar Apr 01 '24 17:04 stnguyen90

  1. Create all collections concurrently

I sent a pull request with this change. It works perfect for me :)

BigPapoo avatar Apr 01 '24 17:04 BigPapoo

Hi, thanks for opening this issue.

I'm curious, why do you need the order of attributes to be retained?

This should not make any difference in practice.

As you said, it should make no difference performance wise or anything like that. For me it is relevant to maintain a structured view of the collections/attributes when using the console. For this I either need this to be "fixed" or a flag for it or https://github.com/appwrite/appwrite/issues/2787

w0rsti avatar May 30 '24 11:05 w0rsti

On the Appwrite version 1.6, the user will be able to change the order of attributes defined in the Appwrite.json file. The steps to reproduce will be as follows:

  1. Login to Appwrite with appwrite login
  2. Initialize a project using appwrite init
  3. Pull a collection with appwrite pull collections
  4. Change the order of the attributes listed in appwrite.json
  5. Delete the collection in the Appwrite Cloud Console
  6. Push your changes using appwrite push collections

You will be able to confirm the attributes order in your collection are the same as the ones in your appwrite.json file

choir241 avatar Jul 16 '24 17:07 choir241