It’s possible to create a transaction-less test environment as a copy of production using the new unified environments.
You reduce your storage footprint by removing transaction data. For interest, this can also be achieved directly through SQL using a script generated by the following X++ runnable class:
internal final class RunnableClass1
{
public static void main(Args _args)
{
TextStreamIo writeStreamIO = TextStreamIo::constructForWrite();
writeStreamIO.outRecordDelimiter('\n');
Dictionary dict = new Dictionary();
for (int i = 1; i <= dict.tableCnt(); i++)
{
SysDictTable sysDictTable = new SysDictTable(dict.tableCnt2Id(i));
TableGroup tableGroup = sysDictTable.tableGroup();
if (!sysDictTable.isMap() && !sysDictTable.isTmp() &&
!sysDictTable.isView() && !sysDictTable.isDataEntity() &&
(tableGroup == TableGroup::Transaction ||
tableGroup == TableGroup::WorksheetHeader ||
tableGroup == TableGroup::WorksheetLine ||
tableGroup == TableGroup::Worksheet ||
tableGroup == TableGroup::TransactionHeader ||
tableGroup == TableGroup::TransactionLine ||
tableGroup == TableGroup::Staging))
{
writeStreamIO.write(strFmt("IF OBJECT_ID (N'%1', N'U') IS NOT NULL TRUNCATE TABLE %1;", sysDictTable.name()));
}
}
File::SendFileToUser(writeStreamIO.getStream(), @"cleardown.sql");
}
}
Leave a comment