๐ PostgreSQL Database
In this lab you will be migrating data from a PostgreSQL relational database. You have a few options to set up this database. Choose one option for your PostgreSQL database.
Option 1: Use a pre-configured databaseโ
If you are participating in an instructor-led lab, they may have already set up this database for you. Ask your instructor for the connection URI and credentials.
In an intructor-led lab you will use the provisioned PostgreSQL database, no need to do anything else
Option 2: Load the schema and data into your own PostgreSQL serverโ
If you already have a PostgreSQL server set up, you can import the schema and data used in this lab. Download the file 1-library-schema-and-data.sql file and load it using psql or pgAdmin.
Option 3: Run a PostgreSQL container using Dockerโ
If you don't have an existing PostgreSQL server but have Docker installed, you can easily load a container pre-configured with PostgreSQL and the sample database:
- Clone or download the code from this lab's Github repo.
- Open a terminal window and navigate to the repo root
- Build the Docker image by running the command:
docker build -f ./docker/sample-postgres-library/Dockerfile -t sample-postgres-library .
- Start the Docker container by running the command:
docker run -p 5432:5432 sample-postgres-library
The PostgreSQL server can be accessed at localhost:5432 with a username of postgres
and a password of postgres
.
Option 4: Load an SQL fileโ
Choose this option if you just want a quick hands-on experience and you don't need to run actual migration. Download the file library-schema.sql and upload this file to the Relational Migrator later, at the create a project step.
This is just the schema of the database, without actual data, so, you will not be able to perform an actual migration since you do not have a source database. But you can model the schema and play around with the Relational Migrator.