Skip to content

Commit

Permalink
feat: add page column to database schema DOC-1138 (#6)
Browse files Browse the repository at this point in the history
* feat: add page column to database schema DOC-1138

* Update README.md

Co-authored-by: caroldelwing <[email protected]>

* Update README.md

Co-authored-by: Karl Cardenas <[email protected]>

---------

Co-authored-by: caroldelwing <[email protected]>
Co-authored-by: Karl Cardenas <[email protected]>
  • Loading branch information
3 people authored Sep 5, 2024
1 parent 650b527 commit b2c59d0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
43 changes: 36 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Hello Universe DB

A Spectro Cloud demo application. This is the database that supports the Hello Universe app.
A Spectro Cloud demo application. This is the database that supports the [Hello Universe API](https://github.com/spectrocloud/hello-universe-api).

<p align="center">
<img src="./static/img/spectronaut.png" alt="drawing" width="400"/>
Expand All @@ -12,13 +12,41 @@ A Spectro Cloud demo application. This is the database that supports the Hello U

The [Hello Universe](https://github.com/spectrocloud/hello-universe) app includes an [API server](https://github.com/spectrocloud/hello-universe-api) that relies on a Postgres database for storing the number of clicks and other metadata about the clicks such as the browser, os, and timestamp. For your convenience, a Postgres container is available for use.

## Prerequisites

Ensure [Docker Desktop](https://www.docker.com/products/docker-desktop/) is available on your local machine.

- Use the following command and ensure you receive an output displaying the version number.
```
docker version
```
Alternatively, you can install [Podman](https://podman.io/docs/installation).
- If you are not using a Linux operating system, create and start the Podman Machine in your local environment. Otherwise, skip this step.
```
podman machine init
podman machine start
```
- Use the following command and ensure you receive an output displaying the installation information.
```
podman info
```
## Usage
To get use the container you can issue the following command to download the container.
You can issue the following commands to use the container with Docker.
```
docker pull ghcr.io/spectrocloud/hello-universe-db:1.1.0 && \
docker run -p 5432:5432 ghcr.io/spectrocloud/hello-universe-db:1.1.0
```
If you choose Podman, you can use the following commands.
```
docker pull ghcr.io/spectrocloud/hello-universe-db:1.0.2 && \
docker run -p 5432:5432 ghcr.io/spectrocloud/hello-universe-db:1.0.2
podman pull ghcr.io/spectrocloud/hello-universe-db:1.1.0 && \
podman run -p 5432:5432 ghcr.io/spectrocloud/hello-universe-db:1.1.0
```
The command you issued downloaded the container and exposed port `5432`. The default user name is `postgres` and the password is `password`.
Expand All @@ -30,9 +58,10 @@ The database uses the following schema for the `counter` table.
| Field | Description | Type |
| --------- | -------------------------------------------- | --------- |
| `id` | The primary key. | Number |
| `date` | The timestamp of the click. | Timestamp |
| `browser` | The web browser used to click by the client. | Varchar |
| `os` | The operating system used by the client. | Varchar |
| `page` | The page associated with the event. | Varchar |
| `date` | The timestamp of the event. | Timestamp |
| `browser` | The client web browser. | Varchar |
| `os` | The client operating system. | Varchar |
## Image Verification
Expand Down
1 change: 1 addition & 0 deletions init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

CREATE TABLE "counter" (
"id" SERIAL PRIMARY KEY,
"page" varchar(255),
"date" timestamp NOT NULL,
"browser" varchar(255),
"os" varchar(255)
Expand Down

0 comments on commit b2c59d0

Please sign in to comment.