Role required: admin.
Local pack is a record in the VCS Local Pack (sys_vcs_local_pack) table compiling relevant records from the VCS Record (sys_vcs_record) table. It allows associating VCS records with a particular pack and exporting them as a complete set. Local packs allow developing application configurations on a separate instance, exporting it as a .SOP file, and implementing it to another instance.
See the Configuration Packs article to learn more.
For configuration pack export, the following elements are used:
- Local Pack – compiles all relevant VCS records so that they are linked as a complete set. Then these records can be implemented as one configuration pack in another instance. In other words, local pack collects references to records that will be changed, inserted, or deleted on the target instance.
- VCS Record – contains the version of a record.
- .SOP file – physical file in the .SOP format. It contains all record versions from the completed local pack. Implement it on any other SimpleOne instance.
Assembling a local pack
Local pack configuration and export includes the following important stages:
- Configuring VCS records in a local pack:
- restoring records (optional)
- moving records (optional)
- Merging several local packs (optional).
- Exporting a .SOP file.
If you are going to export records for a custom application, make sure that the relevant application is implemented in the target instance or that the local pack contains the application VCS record.
If you need to implement the custom application, perform the following steps on the source instance:
- Navigate to Configuration → Applications.
- Find the application record using the list search or the Condition Builder and open it.
- Scroll down to the Related Lists area.
In the VCS Record tab, open a relevant record (with the Is Current=true).
- In the VCS Record form, select the local pack you need in the Local Pack field.
- Click Save or Save and Exit.
Team Development
In SimpleOne, you can export separate local packs and upload them one by one. Another option is to work as a team on one task. For this, developers should do their part of work in separate local packs and then combine the results into team's final pack. You can see the process in the scheme below:
Briefly, in order to facilitate the team development process, you need to perform the following steps:
- Every team member creates a separate local pack and works within it collecting necessary records. The results go into separate local packs.
- When assembling is over, these local packs must be merged into the final one.
Create a local pack
To create a local pack, complete the steps below:
- Navigate to Configuration → Local Packs.
- Click New and fill in the fields.
- There are two ways to apply changes and continue assembling a local pack:
- Click Save. Then click Set current to switch the local pack in the Admin Preferences menu and start working on it.
- Click Set current and Save to switch the local pack in the Admin Preferences menu, apply changes and start working on it.
VCS Local Pack form fields
Field | Mandatory | Description |
---|---|---|
Name | Y | Define the name of the local pack. |
Is Default | N | Select this checkbox to set the local pack as default. When moving version from other local packs, selected VCS records will be moved to this default pack. |
State | Y | Local pack state. Available options:
|
Application | N | Select an application which records this local pack contains. One local pack cannot contain records belonging to different applications. |
Description | N | Type local pack description. |
Managing VCS records
Configure the set of record versions in the VCS Records related list to build the local pack. Restore and move records to collect only those you need.
Restoring a VCS record
If you need to restore one of previous record versions, you need to make it actual by clicking Restore Version. Actual records are marked with the Is current checkbox selected. Thus, restoring is available only to the VCS records with the cleared Is Current checkbox.
Restoring is unavailable for records with the Protected record policy and related to the Simple application.
To restore a record version, complete the steps below:
- Open the record you need.
- Scroll down to the Related Lists area and open the VCS Records tab.
- Open the record version you need to restore.
- Click Restore Version.
Another way to restore a record version is the following:
- Navigate to Configuration → VCS Records.
- Find the record to be recovered. You can use list search boxes or the Condition Builder.
- Open the record you need.
- Click Restore Version.
After that, a new VCS record is created in the current local pack.
Removing a VCS record
VCS records cannot be deleted; therefore, they are moved to the default local pack. If your local pack contains a VCS record that is created accidentally or belongs to another configuration pack, you can remove it from this local pack.
To move a VCS record, perform the following steps:
- Navigate to Configuration → Local Packs.
- Open the local pack containing the VCS record you need to move.
- Scroll down to the Related Lists area and open the VCS Record tab.
- Select a record or records to be moved using the checkboxes and click Move to Default.
- These records will be moved to the default local pack of the same application.
As a result:
- All selected record versions are moved to the default pack.
- All record versions with the same Record ID as the selected ones are moved to the default pack, too. That is, all previous and current versions of the same record are moved.
This option is not available in default local packs.
Changing local pack for a VCS record
If a version was created in a wrong local pack by mistake (for example, in the default local pack), then you can move it to the required local pack. For this, complete the steps below:
- Navigate to Configuration → VCS Records.
- Find a record to recover. You can use list search or the Condition Builder.
- Open the record you need.
- Click the magnifier icon by the Local Pack field and choose the desired local pack.
- Click Save or Save and Exit to apply changes.
Local pack merging
Sometimes you need to combine two or more local packs together, for example, in case of team development. Merged local packs speed up implementation process and help to arrange updates and development in one pack.
Before merging local packs, make sure that:
- Both local packs are in the Completed state.
- Both local packs belong to the same application.
To merge local packs, complete the steps below:
- Navigate to Configuration → Local Packs.
- Choose local packs you need to merge by selecting the checkboxes, then click Merge.
- Define the name and description of the consequent local pack.
- Click Merge.
As a result:
- A new local pack is created. It contains latest versions of the VCS Record (sys_vcs_record) from merged local packs.
- This new local pack state is In Progress.
- The original local packs are removed.
- VCS records will have the name of the merged local pack in the Local Pack field (instead of removed one).
Exporting a local pack
After you completed collecting record versions, you need to export the changes for further import to other instances. For this, please complete the steps below:
- Navigate to Configuration → Local Packs.
- Find the local pack to export. You can use list search boxes or the Condition Builder.
- Open the desired local pack.
Change the state value to Completed.
The local pack in the Admin Preferences menu will change to the default pack.
- Export the local pack as a .SOP file:
- at the top of the form, click Export Local Pack.
OR - in the hamburger menu , select Export → As a New Application.
- at the top of the form, click Export Local Pack.
Use this option cautiously. In case the local pack contains updated vendor records, it may cause collisions while updating the system.
We recommend using the Export Local Pack option.
The downloaded .SOP file will be named automatically as this: Local Pack name_2021-12-31 18:00:00
- Datetime format is YYYY-MM-DD.
- The timestamp indicates the datetime when the local pack was transferred to the Complete state.
- The time is displayed according to the locale of the user who exported the file. That is, if the local pack was transferred to the Complete state at 12:00:00 UTC, then for a user from UTC+3 the file will have the 15:00:00 timestamp.
If the local pack name contains the symbols listed below, they will be replaced by the underscore symbol ( _ ):
\, /, :, *, ?, ", <, >, |
.SOP file export comparison
Export Local Pack | Export → As a New Application | |
---|---|---|
Protection Policy | Does not change. | The policy will be changed to Protected or Open depending on the protected.essences property:
|
Description | Use this export for minor record version changes. | Use this export for local pack containing a huge number of record versions. Do not use the option Export → As a New Application for local packs containing vendor records. It may cause collisions while updating the system. Instead, use the Export Local Pack option. |
As a result, for all configuration records, which versions are contained in the local pack, the current version (Is Current IS Yes) will be downloaded.
If there is no current version for a configuration record in the local pack, then the last version that was created will be downloaded as current. This version also will be current when the local pack will be uploaded on the other instance.
It is a good practice to download your local pack straight away after the job is done; otherwise, the versions stored in it may go out of date.
Snapshots
Snapshots restore record versions in the following cases:
- a record lacks current versions
- the current version of a record is outdated – when the JSON Copy of this record version has later date than the Updated at field of the record itself.
In version control systems (VCS), snapshot is the fixed system or database status description.
There are two ways to create a table snapshot:
- via table managing form (table configuration)
- with server-side API class SimpleVcs.
Option 1
- Navigate to System Settings → All Tables.
- Using the search bar and/or a Condition Builder, find the table for which you want to create a snapshot, and navigate to it.
- Open the hamburger menu and navigate to Configure → Table.
- Click the Create VCS snapshot button at the right top. This button is visible only when the versioning for this table is on (the Is VCS Enabled checkbox is selected).
Option 2
- Navigate to System Settings → Scripts.
- Write down a script and call createTableSnapshot(tableName) method in it.
The example script below makes snapshot of all versioned tables within the current application:
const table = new SimpleRecord('sys_db_table'); table.addQuery('is_vcs_enabled', true); table.addQuery('sys_id', '!=', '999999999999999998'); // exclude REM table.selectAttributes('name'); table.query(); while (table.next()) { const vcs = new SimpleVcs(); const versionCount = vcs.createTableSnapshot(table.name); if (versionCount > 0) { ss.info(`${table.name.padStart(80, " ")}: ${versionCount} versions created`); } }
/
- No labels