Lines

Gen 3

Lines

Database transaction test scripts

Augmented scripts are useful for testing updates that require large amounts of data change, such as updating thousands of rows related to client payment information when a client transitions to a new API, and require various developers to review queries, which helps cut down the chance of errors. Plus, with augmented scripts, engineers can save and copy revert queries to use in case they need to make any changes after the query runs.

Database transaction scripts are optimal for data maintenance and organization. The query includes information about specific transactions, such as the creator’s name, client name(s), the associated ticket number (Jira, Zendesk), and what the transaction achieves. Since the original PR contains all conversations related to the query, all necessary information is centralized. After a query’s PR is closed, engineers can easily search for it by date in GitHub.

Note: Queries created using this method aren’t merged. Instead, they’re closed as soon as the scripts run; otherwise, the folder containing these scripts would become too large and unmanageable over time.

To run the query:

  1. Navigate to your local container.
  2. In your local container, type the bin britecore_shell.py
  3. Type help > developer
  4. Type help > query_scripts
  5. Type the applicable information for the following prompts:
    1. Enter your name
    2. Enter the client(s) to run query on
    3. Enter what this transaction will (do)

      Example: update every user to be John Smith

    4. Enter the associated ticket

      Example: zendesk 1111

    5. Press Enter then paste your query
    6. Enter a select version of your query

      Note: This allows you to see all the data that will be changed before you make the changes.

    7. Enter Y for “Can this query be reverted?”
    8. Press Enter to input your revert query
    9. Enter Y to have a select version
    10. A new query script is created
  1. In your text editor, open the query_scripts folder, and then, select the query you created.
  2. Create a PR containing the new file.
  3. Ask another developer to review the query to ensure it produces the expected results.
  4. Run the select query in MySQL or RunDeck.
  5. Close the PR.

Important: Don’t merge.

For more information, read PR 11108.