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.
Table of Contents
Step-by-Step Tutorial: Completing Task 2 for Assignment 2
Prerequisites:
- 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:
-
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".
-
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".
-
Wait for Database Availability:
- It may take some time for the database to be available. Pause the video until the database is ready.
-
Get External Database URL:
- Scroll to the bottom of the available database and copy the external IP address.
-
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.
-
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.
-
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.
-
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.