707
Views
7
Comments
Delete existing data in Test environment
Question

I have two environments Development and Test. I developed some screens and moved code to Test environment using lifetime. Some testing was done in Test environment which saved data in entities. Now I have made some more changes in Development environment and want to move all the code to Test environment again. However, I also want the database to be cleaned in Test environment . Any idea how to clean the existing data in Test environment?

2018-01-05 02-53-30
Grayson Udstrand

The best way to do this would be to write a timer action which deletes all the records from the tables one at a time. There are a couple ways to do this: you could use aggregates and iterate across the records to delete them, or you could use the SQL widget to try and truncate the tables one by one. You will just need to be mindful to delete the entities that are not referenced by any other entities first to maintain database integrity.

2021-01-27 16-01-28
Rodolfo Póvoa Leal
Champion

Hi Junald,

You can use the timers to resolve your questions. This link has a explan about using timers. (https://success.outsystems.com/Documentation/11/Developing_an_Application/Use_Timers).

As Grayson say, you need to be careful about the relationship between your entities, and cascade deleting.

You can read this in: https://success.outsystems.com/Documentation/10/Developing_an_Application/Use_Data/Data_Modeling/Entity_Relationships/Delete_Rules


And: https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Data/Database_Reference/Database_Constraints


Have a nice job

2024-12-18 16-06-42
Junaid Syed

Hi Grayson,

I thought there would be a more smoother way of doing it, may be something in lifetime. My requirement is to clean the data and I am fine with removing the existing code too from Test environment i.e. start fresh with a clean slate, is there some option available in platform to do this?

2021-01-27 16-01-28
Rodolfo Póvoa Leal
Champion

Junaid Ahmed Syed wrote:

Hi Grayson,

I thought there would be a more smoother way of doing it, may be something in lifetime. My requirement is to clean the data and I am fine with removing the existing code too from Test environment i.e. start fresh with a clean slate, is there some option available in platform to do this?

If you want to clear your table data, I think a Timer is the best option.

you can use DBCleaner, but it will erase your table, and that's not good.


This is what DBCleaner can do:

Friendlier (and automatic) old solution version deletion
Friendlier (and automatic) old application version deletion
Friendlier (and automatic) old eSpace version deletion
Full history and error logs via Outsystems service center
eSpace version listing with solution and application
Delete old emails
Delete old processes (with a timer)
Delete database tables and attributes


best regards
Rodolfo Póvoa


2021-07-19 14-21-08
Carlos Alfradique

Hi there Junaid,

Can you use the component of Forge DBCleaner (https://www.outsystems.com/forge/Component_Details.aspx?ProjectId=423), but I believe you delete table from table

I've created an idea to create the script to delete the cascading database, but it has not yet been implemented.
https://www.outsystems.com/ideas/5591/script-delete-all-records


Regards,

Carlos Alfradique

2018-01-05 02-53-30
Grayson Udstrand


I've created an idea to create the script to delete the cascading database, but it has not yet been implemented.
https://www.outsystems.com/ideas/5591/script-delete-all-records


Junaid, I also have an idea for something to make the process easier, but unfortunately there is not a great way at the moment.

There is one other possibility: you could rename your project and clone it in your environment. That would give you a fresh copy of the application without any data in the new tables. You will just need to be careful to change the names so there is not a namespace collision in the database.

2014-10-21 20-15-17
Alberto Ferreira

Hello Junaid

If that is one operartion that you will do  often. the best way is to create one action with some advanced SQL nodes that deletes the contents of tables 


Delete From {entityname}  



be careful with the entities relations

Best regards

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.