Skip to main content
All CollectionsTx
Tx. Deployment to Environment
Tx. Deployment to Environment
I
Written by Ivan Lopez
Updated over 2 months ago

Environments and deployments are crucial for ensuring the reliability and efficiency of Tx. By segregating the development, testing, and production stages, organizations can isolate experimental changes, thoroughly test new features, and protect live data from unintended impacts. This structured approach minimizes risks, facilitates error containment, and allows for safe rollbacks when necessary.

Moreover, utilizing multiple environments enhances team collaboration, supports compliance and security protocols, and optimizes performance through tailored configurations. It enables consistent and reproducible deployments via version control and configuration management, ensuring that only validated code reaches production.

Deploying a commit to an environment in the Tx project follows a systematic process, ensuring that all Tx objects are deployed accurately and efficiently.

Below is a guide that explains the key steps involved in deploying a Git commit to non-development environments.

Initiating the deployment

To initiate a deployment, the user can access the "Deploy" button located on the toolbar. Upon clicking, a deploy popup is displayed, guiding the user through the environment selection and deployment process.

Selecting the environment

  • Environment List: A list of all available environments (excluding the current environment that represents the development environment) is presented in the popup. Each environment entry includes its name, type, and the last commit details.

  • Environment Selection: Users can select an environment by clicking on its name. Once selected, the environment becomes highlighted, indicating it's ready for deployment. It is important to note that a selected environment cannot be deselected unless another environment is chosen.

Selecting a commit

Once the environment is selected, the next step is to choose a branch and a corresponding commit:

  • Branch Selection: Users can view a list of all available Git branches, sorted in ascending order. Selecting a branch displays all commits associated with it. Users can search for a specific branch using the search field.

  • Commit Selection: Each commit is represented by its ID (first 8 characters), author, comment, and timestamp. The user selects the desired commit for deployment from this list.

Previewing deployment

After selecting the commit, a preview of the deployment will be shown, which includes the following:

  • Tx Objects: The system compares the DDL script from the selected commit with the current environment. Based on this comparison, the system generates CREATE or ALTER scripts for new and updated objects, respectively. The proposed ALTER scripts shall be reviewed and modified manually if needed to avoid data loss.

  • Mapping Section: Displays the mappings of Tx objects to locations, such as databases and schemas.

  • Tx Templates: Displays the Properties, Create script, and Run script for all Tx templates.

Understanding the ALTER Statement Process and Clone Tables

Tx employs a method that uses clone (copy) tables to ensure that any changes are first applied to a copy, safeguarding the original table from potential errors. This is the complete process:

  • Creation of a Clone Table. When Tx generates an ALTER statement, it first creates a clone (copy) of the original table.

  • Applying the ALTER Operation. The system performs the ALTER operation on the clone table. This step isolates any issues that might occur during the modification process.

  • Swapping Tables on Success. If the ALTER operation is successful on the clone table:

    • The system swaps the original table with the altered clone table.

    • After the swap, the cloned table is dropped to free up resources.

  • Failed ALTER Operation: If any ALTER operation fails on the clone table:

    • The clone table is dropped automatically.

    • The original table remains intact and unaffected. No Data Loss: This process ensures that your data remains safe even if modifications do not go as planned.

Identifying ALTER Scripts for Different Tx Objects

An icon will differentiate ALTER scripts for the different Tx Objects. This visual aid helps quickly identify and manage scripts associated with specific objects in your database.

Important Warning Before Deployment

Before deploying any ALTER scripts, a warning will showcase:

Please verify the proposed ALTER script and edit if necessary to avoid data loss.

  • Action Required:

    • Review the Script: Carefully check the proposed ALTER script.

    • Edit if Necessary: Modify the script to fit your specific requirements and to prevent any unintended consequences.

Deploying the objects and viewing results

Once the preview is reviewed, the user can proceed with the deployment. The system will execute the CREATE and ALTER scripts. Once the deployment completes, the results can be viewed in the "View Results" tab. This tab contains the following details:

  • Deployment Summary: A summary of the deployment status, including the number of objects deployed successfully or skipped, is provided on top of the results tab. Includes start and end times, execution duration, and the number of objects inserted, updated, or deleted.

  • For each deployed object:

    • Execution Details: Includes start and end times, execution duration, and the number of objects inserted, updated, or deleted.

    • Deployment Status: A status icon (green, red, or grey) is displayed based on whether the objects deployed successfully, encountered errors, or have been skipped for each item object. Users can open the deploy object and view the executed statement.

This deployment process ensures that all changes are applied accurately while providing users with real-time feedback on deployment progress and results​​​.


See also:

Did this answer your question?