Now that we have identified the bug, it is time to patch it, test it, and then push it upstream.
In this scene, we are going to update the application code to eliminate the bug. Then we will commit our patch and run a couple tests to test it in our environment. Once we are satisfied with our tests, we will push our code upstream.
YOUR STEPS FOR THIS SCENE
- Bring VS Code to the foreground.
- Switch to the Explorer view (purple rectangle, below).
- Switch to the
develop
branch by clicking onmaster
and then selectingdevelop
from the dropdown list. - Expand the sql_code/ddl folders (underlined, below) and then click the new file button (red circle, below)
- Name the new file something like
add_constraint_to_username.sql
- In the new file, copy and paste the following text, then save the file.
ALTER TABLE USERS ADD CONSTRAINT username UNIQUE(username);
- Now let’s commit and push our change. Switch to the Source Control view (yellow box) and click the
+
(yellow circle) icon to add our changes - Add a commit message and click the checkmark to apply the commit.
- Click the sync button (yellow rectangle) to push the changes. Click
OK
button, if prompted. - As before, the push triggers a pipeline build for the
develop
branch. - Once the pipeline job finishes, click the bookmark for the
Patients Dev
and test that you cannot add a duplicate user (like the previous scene) - Once you validate the
Patients Dev
environment, let’s sync our changes and then merge to master, just like we did in Act II Scene I - Now the
master
pipeline build runs in Jenkins. The build should be green and validate that the tests results all pass.
- Go back to our ssh terminal and navigate to
cd ~/git/app_repo/sql_code/ddl
- Checkout the
develop
branchgit checkout develop
- Create a sql file and add the following text to it:
ALTER TABLE USERS ADD CONSTRAINT username UNIQUE(username);
- Save the file and exit the text editor
- Add the file to git, commit the file with a message, and then push the changes to git.
git add add_constraint_to_username.sql git commit -m "username constraint" git push
- As before, the push triggers a pipeline build for the
develop
branch. - Once the pipeline job finishes, click the bookmark for the
Patients Dev
and test that you cannot add a duplicate user (like the previous scene) - Once you validate the
Patients Dev
environment, let’s sync our changes and then merge to master, just like we did in Act II Scene I - Now the
master
pipeline build runs in Jenkins. The build should be green and validate that the tests results all pass.