Assignment 2, Task 2 Overview

3 min read 1 year ago
Published on Apr 23, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Step-by-Step Tutorial: Completing Task 2 for Assignment 2

Prerequisites:

  1. Login and Preparation:
    • Ensure you are logged in to the render.com dashboard.
    • Have PG admin open with the master password entered, but the remote connection should not be active.
    • Have the SQL file containing all creation code from the activities open in VS Code. Ensure the final query from Task 1 is the last item in the file.

Task Execution:

  1. Delete Existing Database:

    • Go to the render.com dashboard and click on the database.
    • Scroll to the bottom and click the "Delete the database" button.
    • Copy the command shown, paste it into the text box, and click "Delete the database".
  2. Create a New Database:

    • While still in the dashboard, click the "New" button and select PostgreSQL.
    • Give the new database a name similar to the previous one, ensuring it's slightly different from the previous name.
    • Select the server closest to your location, leave the version as default, and choose the free tier. Click "Create Database".
  3. Wait for Database Availability:

    • It may take some time for the database to be available. Pause the video until the database is ready.
  4. Get External Database URL:

    • Scroll to the bottom of the available database and copy the external IP address.
  5. Set Up Connection in PG Admin:

    • In PG admin, delete the existing connection to the remote render.com server.
    • Right-click on the server, select "Register Server", and reuse the previous name in the name box.
    • Go to the Connection tab, paste the remote URL into the host name address box, and modify the URL as instructed in the video.
    • Enter the database and usernames, paste the password, and save the connection.
  6. Recreate Database Schema:

    • Expand the database in PG admin and ensure there are no types or tables present.
    • Open the SQL file in VS Code, add tables and data insertions, and include the final query from Task 1 at the very bottom.
    • Copy everything from the SQL file and paste it into the query tool in PG admin under the "public" schema.
  7. Rebuild Database:

    • Click the execute refresh button in PG admin, and it should take less than a second to rebuild everything.
    • Right-click the public schema, select refresh, and expand the type and tables items to ensure they are present.
  8. Verify Data:

    • Right-click on the classification or inventory tables, select "View/Edit Data", and ensure all rows display the expected data.

Conclusion:

By following these steps, you should have successfully completed Task 2 for Assignment 2 as demonstrated in the video. Make sure to verify the database connections and data to ensure everything is set up correctly.