Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into as/feat/active
Browse files Browse the repository at this point in the history
Needed to regenerate migrations yet again,
but hopefully the last time.

Most other conflicts were simple things, although some items in the menu
might have been reordered.
  • Loading branch information
Aleksandar Sredojević committed Feb 7, 2025
2 parents 708dd78 + 0b57282 commit 8a20798
Show file tree
Hide file tree
Showing 93 changed files with 4,637 additions and 1,692 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ MIGRATIONS_PATH="./drizzle" # This is already set for production when building t
DATABASE_URL=postgres://root:mysecretpassword@localhost:5432/local
SECRET=changemeplsbutwith32charsbecauseyes
PUBLIC_INDEX_REGEX="^\d{1,4}[a-zA-Z]?\/(?:\d{2}|\d{4})$"
PUBLIC_GUARANTOR_ELIGIBILITY_HOURS=0 # For testing purposes
PUBLIC_RECTORATE_MODE=false # When true, creating students asks for university instead of department

POSTGRES_USER=root
POSTGRES_PASSWORD=mysecretpassword
Expand Down
2 changes: 2 additions & 0 deletions .env.prod.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ORIGIN=https://example.org # Client facing URL, the exact one which users will u
DATABASE_URL=postgres://root:mysecretpassword@postgres:5432/local # Use docker internal network to connect to the db
SECRET=changemeplsbutwith32charsbecauseyes
PUBLIC_INDEX_REGEX="^\d{1,4}[a-zA-Z]?\/(?:\d{2}|\d{4})$"
PUBLIC_GUARANTOR_ELIGIBILITY_HOURS=80 # Set to 0 to allow any person to guarantee for a guest
PUBLIC_RECTORATE_MODE=false # When true, creating students asks for university instead of department

POSTGRES_USER=root
POSTGRES_PASSWORD=mysecretpassword
Expand Down
2 changes: 1 addition & 1 deletion docker/node.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM node:lts-slim AS base
WORKDIR /app
COPY package.json ./
COPY pnpm-lock.yaml ./
RUN corepack enable
RUN npm install -g pnpm@9

FROM base AS build
RUN pnpm i --frozen-lockfile
Expand Down
23 changes: 23 additions & 0 deletions drizzle/0008_fixed_pestilence.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CREATE TABLE IF NOT EXISTS "university" (
"id" serial PRIMARY KEY NOT NULL,
"name" text NOT NULL,
CONSTRAINT "university_name_unique" UNIQUE("name")
);
--> statement-breakpoint
ALTER TABLE "person" DROP CONSTRAINT "person_identifier_unique";--> statement-breakpoint
ALTER TABLE "person" ALTER COLUMN "department" DROP NOT NULL;--> statement-breakpoint
ALTER TABLE "person" ADD COLUMN "university" text;--> statement-breakpoint
ALTER TABLE "person_entry" ADD COLUMN "guarantor_id" integer;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "person" ADD CONSTRAINT "person_university_university_name_fk" FOREIGN KEY ("university") REFERENCES "public"."university"("name") ON DELETE restrict ON UPDATE cascade;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "person_entry" ADD CONSTRAINT "person_entry_guarantor_id_person_id_fk" FOREIGN KEY ("guarantor_id") REFERENCES "public"."person"("id") ON DELETE restrict ON UPDATE cascade;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
ALTER TABLE "person" ADD CONSTRAINT "person_identifier_university_id_unique" UNIQUE NULLS NOT DISTINCT("identifier","university");
8 changes: 8 additions & 0 deletions drizzle/0009_crazy_colossus.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ALTER TABLE "ratelimit" DROP CONSTRAINT "ratelimit_user_id_user_id_fk";
--> statement-breakpoint
ALTER TABLE "ratelimit" ADD CONSTRAINT "ratelimit_user_id_timestamp_pk" PRIMARY KEY("user_id","timestamp");--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "ratelimit" ADD CONSTRAINT "ratelimit_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE cascade;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
File renamed without changes.
77 changes: 64 additions & 13 deletions drizzle/meta/0008_snapshot.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "d976ece0-5c81-46bc-a88e-0f6189316565",
"id": "1e9e2df8-44b5-4721-b653-7db0b99c5a4e",
"prevId": "81ee13a7-fe6d-4b61-828e-edba465e15b5",
"version": "7",
"dialect": "postgresql",
Expand Down Expand Up @@ -98,7 +98,13 @@
"name": "department",
"type": "text",
"primaryKey": false,
"notNull": true
"notNull": false
},
"university": {
"name": "university",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
Expand All @@ -111,14 +117,23 @@
"columnsTo": ["name"],
"onDelete": "restrict",
"onUpdate": "cascade"
},
"person_university_university_name_fk": {
"name": "person_university_university_name_fk",
"tableFrom": "person",
"tableTo": "university",
"columnsFrom": ["university"],
"columnsTo": ["name"],
"onDelete": "restrict",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"person_identifier_unique": {
"name": "person_identifier_unique",
"nullsNotDistinct": false,
"columns": ["identifier"]
"person_identifier_university_id_unique": {
"name": "person_identifier_university_id_unique",
"nullsNotDistinct": true,
"columns": ["identifier", "university"]
}
}
},
Expand Down Expand Up @@ -150,6 +165,12 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"guarantor_id": {
"name": "guarantor_id",
"type": "integer",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
Expand Down Expand Up @@ -180,6 +201,15 @@
"columnsTo": ["username"],
"onDelete": "no action",
"onUpdate": "cascade"
},
"person_entry_guarantor_id_person_id_fk": {
"name": "person_entry_guarantor_id_person_id_fk",
"tableFrom": "person_entry",
"tableTo": "person",
"columnsFrom": ["guarantor_id"],
"columnsTo": ["id"],
"onDelete": "restrict",
"onUpdate": "cascade"
}
},
"compositePrimaryKeys": {
Expand Down Expand Up @@ -312,6 +342,34 @@
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"public.university": {
"name": "university",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"university_name_unique": {
"name": "university_name_unique",
"nullsNotDistinct": false,
"columns": ["name"]
}
}
},
"public.ratelimit": {
"name": "ratelimit",
"schema": "",
Expand Down Expand Up @@ -372,13 +430,6 @@
"type": "text",
"primaryKey": false,
"notNull": true
},
"disabled": {
"name": "disabled",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
}
},
"indexes": {},
Expand Down
Loading

0 comments on commit 8a20798

Please sign in to comment.