We have now “paused” the data we were previously using and have replaced it with the data from the Test data pod bookmark.

In this scene, we are going validate the presence of the bug, and work to source the root cause of the issue.

YOUR STEPS FOR THIS SCENE:

Part 1

  1. Open Patients Dev in a new tab. Login, and go to the Users section. You should now see we have replicated the “broken test” environment.
  2. Notice the duplicate mcred username. This is the exact state of the bookmarked data in our Test data pod.


  3. Let’s delete the duplicate mcred user. Click the X icon next to one of the mcred usernames
  4. Click OK on the dialog box


  5. The application is now down to three users


  6. Let’s manually add a user to test the bug ourselves. Click the + icon to open the Add User form
  7. Create a user with the username mcred. You can put any values you want into the other fields. Click Save


  8. You should now see your user in the list. Once you verified the user, repeat steps 2 & 3 to delete the user.


Part 2 (Complete the steps for your data type)

  1. It is pretty obvious that the issue is we do not have a unique constraint on our username field. Let’s patch this defect by applying a unique constraint to the username column of the USERS table in our database. The following sql code should do it:
    ALTER TABLE USERS
     ADD CONSTRAINT username UNIQUE(username);
    
  2. Let’s manually apply this to our Dev environent to see if it has the desired effect. Open a terminal window.
  3. SSH into the Development database server as the centos user
    ssh centos@devdb
    
  4. Change to the oracle user.
    sudo su - oracle
    
  5. Connect to the devdb via sqlplus
    sqlplus delphixdb/delphixdb@devdb:1521/devdb
    
  6. Copy and paste the sql code from step 10 into the terminal window and press enter. You should see a message that says Table altered.


  1. It is pretty obvious that the issue is we do not have a unique constraint on our username field. Let’s patch this defect by applying a unique constraint to the username column of the USERS table in our database. The following sql code should do it:
    ALTER TABLE ONLY public.users 
         ADD CONSTRAINT username UNIQUE(username);
    
  2. Let’s manually apply this to our Dev environent to see if it has the desired effect. Open a terminal window.
  3. Connect to the devdb via psql
    psql -h devdb -p 5454 -U postgres dafdb
    
  4. Copy and paste the sql code from step 10 into the terminal window and press enter. You should see a message that says Table altered.


Part 3

  1. Now let’s go to our Dev App and test the fix. Repeat steps 6 & 7 from Part 1, above.
  2. This time, you should notice that the application won’t allow us to add a duplicate user. In a real use case, we would update the application code to also return an error message, but that is beyond the scope of this workshop.
  3. Change the username to something unique and click save to validate that our add user form is still working.
  4. Great. Now let’s submit the patch.