This feature is in Developer Preview and is subject to change.
CLI Documentation Notice
You're viewing documentation for the new Wix CLI, which we recommend for all new projects. Determine which CLI your project uses.
The data collections extension lets your app automatically create data collections in a site's CMS. When a Wix user installs or updates your app, the collections are created with the configuration you define.
Follow the instructions below to:
Once complete, your app automatically creates the specified collections in the CMS whenever a Wix user installs or updates it.
Note: The site that installs your app must have the CMS added. Without the CMS, collections added by the extension won't appear after installation. You can bundle the CMS with your app by adding it as a dependency.
In the terminal:
The first time you run this command, the CLI creates the shared extension file (data-collections.extension.ts) alongside the new collection's definition file. Subsequent runs add new collection definition files to the same shared extension and register them automatically.
Each collection is defined in its own <your-collection-name>.ts file. The default export is an object that describes the collection's schema, permissions, indexes, and initial data. The object follows the schema documented in the data collections extension JSON reference.
You can add multiple collections with the generate command. The CLI generates each collection with default fields and permissions. Edit each collection's <your-collection-name>.ts file to fit your data model.
Learn more about data collections extension files and code.
Release a new app version, then build and deploy your project. Learn more about app version updates.
Note: Collection changes only affect users who update to the new major version. Users on older versions retain their existing collections. Changes can take up to 5 minutes to propagate after an update.
To delete a single collection from your extension:
<your-collection-name>.ts file.data-collections.extension.ts, delete the matching import statement and the entry for that collection from the collections array.To delete the entire data collections extension:
src/extensions/backend/data-collections/ folder.import and .use() statements for the extension from your extensions.ts file.Important: If you already have a version of your app project, you must build and deploy the project again after removing the data collection extension files.