To use the dumpfile, you can use DBeaver or PSQL.
- After installing, set up environment paths to use the psql command.
a) Add this as a System Variable Path.
;C:\Program Files\PostgreSQL\14\bin;C:\Program Files\PostgreSQL\14\lib
- Open a terminal and run
psql -U [username]
Then enter password
CREATE DATABASE [databaseToAddToName];
Go back to the terminal (Ctrl + C or type exit
)
psql -U [username] [databaseToAddToName] < [pathOfDumpFile]
To acquire all of the SQL from the dump file: Using the database manager DBeaver, you first have to create a new database connection with PostgreSQL. Once you have the connection with PostgreSQL, you must create a new database by right clicking on the Databases tab and clicking Create New Database. Now you right-click on the database you just created and click Tools > Execute script. Select the SQL dump file, then click Start.
-
Now the database should be ready to connect to.
-
Clone this repository
-
Open the repository and update the file
app.env
'sDB_SOURCE
DB_SOURCE=postresql://[username]:[password]@[hostName]:[5432]/[databaseToAddToName]?sslmode=disable
-
Finally, in the terminal in this project's root directory, run
go run ./cmd/web/.
-
Going to
localhost:8080
should bring you to the homepage.
-
The front end is located in the
static
andtemplates
folders. -
The
db/migration/000001_init_schema.up.sql
contains just the schema of the database, which isn't needed with the dump file. -
All the queries are located in
internal/repository/dbrepo/postgres.go
-
All the requests are handled by
internal/handlers/handlers.go