A plugin created to add autoincrementable Custom Fields to the Strapi open-source headless CMS.
Internally, it creates a two Content Types to store the counters: one for integers and other for bigintegers.
An entry is created automatically in the corresponding Content-Type when you add one of the Custom Fields and use them for the first time. They add the corresponding value and increment the counter in the beforeCreate
lifecycle hook.
- Add integer counter custom field: Allows you to add a custom field to your Content Types that uses an integer value.
- Add biginteger counter custom field: Allows you to add a custom field to your Content Types that uses a biginteger value, if you want to count a lot.
You need to have a Strapi project with version 4.4 or superior to user Custom Fields.
Inside your Strapi app, add the package:
With npm
:
npm install strapi-plugin-autoincrement
With yarn
:
yarn add strapi-plugin-autoincrement
Then run build:
npm run build
or:
yarn build
Here are some planned improvements for the plugin, but they may change based on design decisions.
- Fix bug on using the integer field in the Content Type Builder (invalid default value)
- Add settings option to select initial counter value (by default they start at 0)