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-2
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.