appwrite icon indicating copy to clipboard operation
appwrite copied to clipboard

🚀 Feature: Add Text attribute

Open senguendk opened this issue 3 years ago • 9 comments

🔖 Feature description

Would it be possible to add back a text attribute that allows for arbitrarily long strings? Most databases provide a native type for this. I feel like Version 0.12 made a step backwards in that regard.

🎤 Pitch

I am creating a cms for scientific articles. Some articles are very long. Since it is not possible to change the settings of an attribute easily once it has been created, it is really tough on deciding on a string size for the content string attribute.

👀 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?

senguendk avatar Jun 16 '22 11:06 senguendk

Hey there 👋

Under the hood, we currently use MariaDB and its data types. You can refer to this piece of the code to see what type we use for specific lengths: https://github.com/utopia-php/database/blob/main/src/Database/Adapter/MariaDB.php#L1182-L1208

As you can see, even TEXT in MariaDB has some limitations regarding length. If you want to be extra safe, I would recommend LONGTEXT by setting size to 16777216. That will under the hood create A LONGTEXTTEXT column with a maximum length of 4,294,967,295 or 4GB ( 2^32 - 1 ) characters..

Regarding version 0.12, the limit was still there, it was just not visible. I believe we used TEXT data type, which is limited to 64kB.

Meldiron avatar Jun 16 '22 14:06 Meldiron

Going back to the feature request, do you think UI changes would be enough to address this problem? Would it be better understood if we showed these breaking points for data types in the UI?

Meldiron avatar Jun 16 '22 14:06 Meldiron

Hey! Man, you guys are quick to respond! Thank you for that!

Yes, that would be great. Maybe some comment or info pop up would be nice. Maybe putting that information in the documentation would be enough also.

senguendk avatar Jun 16 '22 15:06 senguendk

+1 for this feature, text/json attribute is often to use , as I see currently I can't create attribute with text/json in dialog, and documentation too.

folkevil avatar Nov 17 '22 04:11 folkevil

Since arbitrarily long strings won't be supported due to technical constraints, will it be possible to modify size of strings later?

shatanikmahanty avatar Jun 01 '23 04:06 shatanikmahanty

Since arbitrarily long strings won't be supported due to technical constraints, will it be possible to modify size of strings later?

+1. I didn't find how to modify the size of a string attribute.

narnau avatar Jun 15 '23 17:06 narnau

Since arbitrarily long strings won't be supported due to technical constraints, will it be possible to modify size of strings later?

I think the concern is the massive performance impact of doing this. The way data is laid out physically on hard-discs will mean you'd have to shift huge amounts of data in big DBs to change size of a string attribute.

You might be better off creating a new attribute, writing a script to copy existing data to new attribute, and deleting the old attribute.

But this is still and interesting suggestion that we'll look into <3

gewenyu99 avatar Sep 04 '23 04:09 gewenyu99

Any updates on allowing the size of a Text field to be increased?

Thanks.

Sun3 avatar Apr 15 '24 04:04 Sun3

@Sun3 We're still recommending the Expand Contract pattern for now.

Updating a field directly is not a great idea because how heavy a [ALTER COLUMN](https://www.w3schools.com/sql/sql_ref_alter_column.asp) tends to be.

gewenyu99 avatar Apr 15 '24 21:04 gewenyu99