When it will be possible to generate/create a new collection/database by code, defining also all it's DB-Field-Types by code aswell?
@wix
If you need some code for it.....
import wixData from 'wix-data';
const collectionSchema = {
"title": "My Collection",
"description": "This is my collection schema",
"fields": [
{ "name": "name", "type": "text" },
{ "name": "age", "type": "number" },
{ "name": "email", "type": "email" },
{ "name": "dateOfBirth", "type": "date" },
{ "name": "isSubscribed", "type": "boolean" },
{ "name": "avatar", "type": "image" },
{ "name": "description", "type": "text" },
// Add more fields here
]
};
wixData.createCollection("myCollection", collectionSchema)
.then((collection) => {
// Collection has been created with the defined schema
console.log(`Collection ${collection.title} created successfully`);
})
.catch((error) => {
console.error(`Failed to create collection: ${error}`);
});
It is time to implement this function/method to the Wix-Data-API to expand the features and functions of Wix-Data.
I hope this won't take any longer, since the CODE is already here 😁
Make it possible for us, to create databses the dynamic way (by code), instead to generate them all the time manually inside the Content-Manager.
Seems like we will get new API soon....
I ❤️ it !!!!
Great news for me / us!
I agree it would make sense to fully include WixData feature https://dev.wix.com/api/rest/wix-data/wix-data into Wix. I would love to be able retrieve database schema, or to generate/edit collection via code.
Check this out: https://dev.wix.com/api/rest/wix-data/wix-data/data-collections/create-data-collection