Seed & clear table


Is it possible to clear a table before loading the seed data on provisioning?

The case is that I want to completely re-init a table with seed data (or something else), at each provisioning.
How to design that with C3?


@jmdepaepe I’m not sure exactly what the purpose of the type in question is but if you make it mixin Metadata, instead of SeedData, then all user changes will be lost and the type will be populated with only the new provisioned data. If it really needs to be SeedData (only necessary if you expect user changes and WANT to retain them across provisioning), then there is no automatic way to do that during provisioning. You would need to manually call removeSeedDataBatch on the type with the instances you want fully removed from the db.


Yes thanks, that answers to my question.
but also open a new question, how do I do mixing MetaData? Do you have a link to a doc?


Here is an example of a type that mixes Metadata:

entity type Hierarchy mixes Metadata schema name ‘HIER_HIER’…

Simply take your old type and replace ‘SeedData’ with ‘Metadata’ as shown above. If the type doesn’t already mix SeedData you can just add the ‘mixes Metadata’.


Also, here is the doc specified for the Metadata type:

 * Types that mixin Metadata are designated as "metadata" meaning they will have their entry's data sets replaced during
 * provisioning. Any creation/updates to data in metadata types that occurs outside of provisioning will be lost during
 * the next provision.
type Metadata