Skip to content

Commit

Permalink
Last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ludavidca committed Sep 28, 2024
1 parent ae189d7 commit ec030ee
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 58 deletions.
12 changes: 3 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{
"extends": [
"next",
"next/core-web-vitals",
"plugin:prettier/recommended"
],
"plugins": [
"prettier"
],
"extends": ["next", "next/core-web-vitals", "plugin:prettier/recommended"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": [
"error",
Expand All @@ -16,4 +10,4 @@
],
"no-unused-vars": "error"
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@
"npx prisma format"
]
}
}
}
34 changes: 34 additions & 0 deletions prisma/migrations/20240928220618_init/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Warnings:
- You are about to drop the column `numberOfStudents` on the `Absence` table. All the data in the column will be lost.
- You are about to drop the column `subject` on the `Absence` table. All the data in the column will be lost.
- A unique constraint covering the columns `[authId]` on the table `User` will be added. If there are existing duplicate values, this will fail.
- Added the required column `subjectId` to the `Absence` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE "Absence" DROP COLUMN "numberOfStudents",
DROP COLUMN "subject",
ADD COLUMN "subjectId" INTEGER NOT NULL;

-- AlterTable
ALTER TABLE "User" ADD COLUMN "numOfAbsences" INTEGER NOT NULL DEFAULT 10;

-- DropEnum
DROP TYPE "Subject";

-- CreateTable
CREATE TABLE "Subject" (
"id" SERIAL NOT NULL,
"name" TEXT NOT NULL,
"abbreviation" TEXT NOT NULL,

CONSTRAINT "Subject_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "User_authId_key" ON "User"("authId");

-- AddForeignKey
ALTER TABLE "Absence" ADD CONSTRAINT "Absence_subjectId_fkey" FOREIGN KEY ("subjectId") REFERENCES "Subject"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
4 changes: 2 additions & 2 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ model Location {
id Int @id @default(autoincrement())
name String
abbreviation String
absences Absence[]
Absence Absence[]
}

model MailingList {
Expand All @@ -52,7 +52,7 @@ model Subject {
id Int @id @default(autoincrement())
name String
abbreviation String
absences Absence[]
Absence Absence[]
}

enum Role {
Expand Down
62 changes: 16 additions & 46 deletions prisma/seed/.snaplet/dataModel.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,8 @@
"isRequired": true,
"kind": "object",
"relationName": "AbsenceToLocation",
"relationFromFields": [
"locationId"
],
"relationToFields": [
"id"
],
"relationFromFields": ["locationId"],
"relationToFields": ["id"],
"isList": false,
"isId": false,
"isGenerated": false,
Expand All @@ -145,12 +141,8 @@
"isRequired": true,
"kind": "object",
"relationName": "AbsenceToSubject",
"relationFromFields": [
"subjectId"
],
"relationToFields": [
"id"
],
"relationFromFields": ["subjectId"],
"relationToFields": ["id"],
"isList": false,
"isId": false,
"isGenerated": false,
Expand All @@ -163,12 +155,8 @@
"isRequired": true,
"kind": "object",
"relationName": "Absence_absentTeacherIdToUser",
"relationFromFields": [
"absentTeacherId"
],
"relationToFields": [
"id"
],
"relationFromFields": ["absentTeacherId"],
"relationToFields": ["id"],
"isList": false,
"isId": false,
"isGenerated": false,
Expand All @@ -181,12 +169,8 @@
"isRequired": false,
"kind": "object",
"relationName": "Absence_substituteTeacherIdToUser",
"relationFromFields": [
"substituteTeacherId"
],
"relationToFields": [
"id"
],
"relationFromFields": ["substituteTeacherId"],
"relationToFields": ["id"],
"isList": false,
"isId": false,
"isGenerated": false,
Expand All @@ -197,9 +181,7 @@
"uniqueConstraints": [
{
"name": "Absence_pkey",
"fields": [
"id"
],
"fields": ["id"],
"nullNotDistinct": false
}
]
Expand Down Expand Up @@ -273,9 +255,7 @@
"uniqueConstraints": [
{
"name": "Location_pkey",
"fields": [
"id"
],
"fields": ["id"],
"nullNotDistinct": false
}
]
Expand Down Expand Up @@ -335,9 +315,7 @@
"uniqueConstraints": [
{
"name": "MailingList_pkey",
"fields": [
"id"
],
"fields": ["id"],
"nullNotDistinct": false
}
]
Expand Down Expand Up @@ -411,9 +389,7 @@
"uniqueConstraints": [
{
"name": "Subject_pkey",
"fields": [
"id"
],
"fields": ["id"],
"nullNotDistinct": false
}
]
Expand Down Expand Up @@ -571,23 +547,17 @@
"uniqueConstraints": [
{
"name": "User_pkey",
"fields": [
"id"
],
"fields": ["id"],
"nullNotDistinct": false
},
{
"name": "User_authId_key",
"fields": [
"authId"
],
"fields": ["authId"],
"nullNotDistinct": false
},
{
"name": "User_email_key",
"fields": [
"email"
],
"fields": ["email"],
"nullNotDistinct": false
}
]
Expand Down Expand Up @@ -620,4 +590,4 @@
]
}
}
}
}

0 comments on commit ec030ee

Please sign in to comment.