Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/deploy-to-vm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@

name: CI/CD - Deploy to VM

on:
workflow_run:
workflows: ['CI/CD - Linter, formatter and tests']
types: [completed]
branches:
- main
on: workflow_dispatch

permissions:
contents: read
Expand Down Expand Up @@ -79,6 +74,9 @@ jobs:
printf 'DATABASE_URL="%s"\n' "$DATABASE_URL" > apps/backend/.env
cp apps/backend/.env packages/db/.env
- name: Apply database migrations
run: pnpm --filter @t09-project-2/db run db:push

- name: Generate Prisma client
run: pnpm --filter @t09-project-2/db run db:generate

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Most recent commit hash at time of hand-in: [`efdbfa5`](https://git.ntnu.no/IT28

Handed in Oct 16th

Most recent commit hash at time of hand-in: [`TDB`](<>) (Will update if there is a more recent version in the future)
Most recent commit hash at time of hand-in: [`054801b`](https://git.ntnu.no/IT2810-H26/T09-Project-2/tree/054801b7b8058fe35a5303cd54ff7815cbac0be8)

### 3rd hand-in of project 2

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
db:
container_name: g_spotter_db
image: postgres:16-alpine@sha256:b7587f3cb74f4f4b2a4f9d67f052edbf95eb93f4fec7c5ada3792546caaf7383
image: postgres:18-alpine@sha256:898c60cb390d1085bc97bdd6a1ae968757421df394b071848b52b1c09c89d6a5
restart: always
environment:
POSTGRES_PASSWORD: gspotter
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- AlterTable
ALTER TABLE "city" ALTER COLUMN "id" SET DEFAULT uuidv7();

-- AlterTable
ALTER TABLE "opening_hours" ALTER COLUMN "id" SET DEFAULT uuidv7(),
ALTER COLUMN "opening" SET DATA TYPE TIMETZ,
ALTER COLUMN "closing" SET DATA TYPE TIMETZ;

-- AlterTable
ALTER TABLE "price_sighting" ALTER COLUMN "id" SET DEFAULT uuidv7(),
ALTER COLUMN "time_start" SET DATA TYPE TIMETZ,
ALTER COLUMN "time_end" SET DATA TYPE TIMETZ;

-- AlterTable
ALTER TABLE "venue" ALTER COLUMN "id" SET DEFAULT uuidv7();
60 changes: 30 additions & 30 deletions packages/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ datasource db {
}

enum GlassSize {
PINT @map("PINT")
HALF_LITER @map("HALF_LITER")
PINT @map("PINT")
HALF_LITER @map("HALF_LITER")
QUARTER_LITER @map("QUARTER_LITER")
BOX @map("BOX")
OTHER @map("OTHER")
BOX @map("BOX")
OTHER @map("OTHER")
@@map("glass_size")
}

enum Limitations {
TIME @map("TIME")
TIME @map("TIME")
MEMBERSHIP @map("MEMBERSHIP")
@@map("limitations")
Expand All @@ -43,55 +43,55 @@ enum Day {
}

model Venue {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
name String
id String @id @default(dbgenerated("uuidv7()")) @db.Uuid
name String
address String
openingHours OpeningHours[]
cityId String @db.Uuid @map("city_id")
city City @relation(fields: [cityId], references: [id])
cityId String @map("city_id") @db.Uuid
city City @relation(fields: [cityId], references: [id])
pricesSighted PriceSighting[]
@@map("venue")
}

model OpeningHours {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
days Day[]
opening DateTime @db.Timestamptz()
closing DateTime @db.Timestamptz()
id String @id @default(dbgenerated("uuidv7()")) @db.Uuid
days Day[]
opening DateTime @db.Timetz()
closing DateTime @db.Timetz()
venueId String @db.Uuid @map("venue_id")
venue Venue @relation(fields: [venueId], references: [id])
venueId String @map("venue_id") @db.Uuid
venue Venue @relation(fields: [venueId], references: [id])
@@map("opening_hours")
}

model City {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
name String
centreLon Float @map("centre_lon")
centreLat Float @map("centre_lat")
id String @id @default(dbgenerated("uuidv7()")) @db.Uuid
name String
centreLon Float @map("centre_lon")
centreLat Float @map("centre_lat")
venues Venue[]
@@map("city")
}

model PriceSighting {
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
price Float
size GlassSize
limitation Limitations[]
timeStart DateTime? @db.Timestamptz() @map("time_start")
timeEnd DateTime? @db.Timestamptz() @map("time_end")
sizeMl Float? @map("size_ml")
timeSighted DateTime @db.Timestamptz() @map("time_sighted")
venueId String @db.Uuid @map("venue_id")
venue Venue @relation(fields: [venueId], references: [id])
id String @id @default(dbgenerated("uuidv7()")) @db.Uuid
price Float
size GlassSize
limitation Limitations[]
timeStart DateTime? @map("time_start") @db.Timetz()
timeEnd DateTime? @map("time_end") @db.Timetz()
sizeMl Float? @map("size_ml")
timeSighted DateTime @map("time_sighted") @db.Timestamptz()
venueId String @map("venue_id") @db.Uuid
venue Venue @relation(fields: [venueId], references: [id])
@@map("price_sighting")
}
2 changes: 1 addition & 1 deletion scripts/setup-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fi

apt-get update -y

if ! apt-get install -y postgresql-16; then
if ! apt-get install -y postgresql-18; then
apt-get install -y postgresql
fi

Expand Down