Reset Database to Empty

0
Hello friends, I'm a bit of a noob so please excuse the question if it has been answered before. I'm trying to find a way to reset the database inside an app to the initial state when an app if first created. Is there a command or procedure one can run/do to have the app recreate an empty database? Thank you,   Jeff G
asked
2 answers
1

Hi Jeff,

Another option (assuming you're talking about your local development environment) is to delete the "deployment" folder in your project directory. The next time you start the app from the modeler, it will be empty.

answered
0

Hi Jeffrey,

You can delete your entire database using the mendix model reflection module and the community commons java action delete all.

 

The java action will delete an entire table using the module name and the table name.

ex: MyFirstModule.Table

 

The model reflection keep a record of every table that you sync with the module name and table name. So you can retrieve all the model reflection objects and use the delete all java action in an iterator. 

Here is an example. If you copy this link you can import it into your mendix project by pressing ctrl-v.

https://modelshare.mendix.com/models/c824166b-489c-4a88-9d15-4b40437b21cd/delete-entire-database

 

Also, this will only work if you run the model reflection and have all modules checked when you sync everything. 

 

 

Here is the links to the model reflection module and the community commons module 

https://appstore.home.mendix.com/link/app/69/Mendix/Mx-Model-reflection

https://appstore.home.mendix.com/link/app/170/Mendix/Community-Commons-Function-Library

 

Hope this helps!

answered