first praktikum variant
This commit is contained in:
BIN
prisma/dev.db
Normal file
BIN
prisma/dev.db
Normal file
Binary file not shown.
BIN
prisma/dev.db-journal
Normal file
BIN
prisma/dev.db-journal
Normal file
Binary file not shown.
21
prisma/migrations/20250415121207_init/migration.sql
Normal file
21
prisma/migrations/20250415121207_init/migration.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "Anmeldung" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"anrede" TEXT NOT NULL,
|
||||
"vorname" TEXT NOT NULL,
|
||||
"nachname" TEXT NOT NULL,
|
||||
"geburtsdatum" TEXT NOT NULL,
|
||||
"strasse" TEXT NOT NULL,
|
||||
"hausnummer" TEXT NOT NULL,
|
||||
"ort" TEXT NOT NULL,
|
||||
"plz" TEXT NOT NULL,
|
||||
"telefon" TEXT NOT NULL,
|
||||
"email" TEXT NOT NULL,
|
||||
"schulart" TEXT NOT NULL,
|
||||
"zeitraum" TEXT NOT NULL,
|
||||
"motivation" TEXT NOT NULL,
|
||||
"wunsch1" TEXT NOT NULL,
|
||||
"wunsch2" TEXT NOT NULL,
|
||||
"wunsch3" TEXT NOT NULL,
|
||||
"timestamp" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- A unique constraint covering the columns `[email]` on the table `Anmeldung` will be added. If there are existing duplicate values, this will fail.
|
||||
|
||||
*/
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Anmeldung_email_key" ON "Anmeldung"("email");
|
||||
52
prisma/migrations/20250415125317_dienststellen/migration.sql
Normal file
52
prisma/migrations/20250415125317_dienststellen/migration.sql
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `wunsch1` on the `Anmeldung` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `wunsch2` on the `Anmeldung` table. All the data in the column will be lost.
|
||||
- You are about to drop the column `wunsch3` on the `Anmeldung` table. All the data in the column will be lost.
|
||||
- Added the required column `wunsch1Id` to the `Anmeldung` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `wunsch2Id` to the `Anmeldung` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `wunsch3Id` to the `Anmeldung` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- CreateTable
|
||||
CREATE TABLE "Dienststelle" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"name" TEXT NOT NULL
|
||||
);
|
||||
|
||||
-- RedefineTables
|
||||
PRAGMA defer_foreign_keys=ON;
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_Anmeldung" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"anrede" TEXT NOT NULL,
|
||||
"vorname" TEXT NOT NULL,
|
||||
"nachname" TEXT NOT NULL,
|
||||
"geburtsdatum" TEXT NOT NULL,
|
||||
"strasse" TEXT NOT NULL,
|
||||
"hausnummer" TEXT NOT NULL,
|
||||
"ort" TEXT NOT NULL,
|
||||
"plz" TEXT NOT NULL,
|
||||
"telefon" TEXT NOT NULL,
|
||||
"email" TEXT NOT NULL,
|
||||
"schulart" TEXT NOT NULL,
|
||||
"zeitraum" TEXT NOT NULL,
|
||||
"motivation" TEXT NOT NULL,
|
||||
"wunsch1Id" INTEGER NOT NULL,
|
||||
"wunsch2Id" INTEGER NOT NULL,
|
||||
"wunsch3Id" INTEGER NOT NULL,
|
||||
"timestamp" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT "Anmeldung_wunsch1Id_fkey" FOREIGN KEY ("wunsch1Id") REFERENCES "Dienststelle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
CONSTRAINT "Anmeldung_wunsch2Id_fkey" FOREIGN KEY ("wunsch2Id") REFERENCES "Dienststelle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
CONSTRAINT "Anmeldung_wunsch3Id_fkey" FOREIGN KEY ("wunsch3Id") REFERENCES "Dienststelle" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
);
|
||||
INSERT INTO "new_Anmeldung" ("anrede", "email", "geburtsdatum", "hausnummer", "id", "motivation", "nachname", "ort", "plz", "schulart", "strasse", "telefon", "timestamp", "vorname", "zeitraum") SELECT "anrede", "email", "geburtsdatum", "hausnummer", "id", "motivation", "nachname", "ort", "plz", "schulart", "strasse", "telefon", "timestamp", "vorname", "zeitraum" FROM "Anmeldung";
|
||||
DROP TABLE "Anmeldung";
|
||||
ALTER TABLE "new_Anmeldung" RENAME TO "Anmeldung";
|
||||
CREATE UNIQUE INDEX "Anmeldung_email_key" ON "Anmeldung"("email");
|
||||
PRAGMA foreign_keys=ON;
|
||||
PRAGMA defer_foreign_keys=OFF;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Dienststelle_name_key" ON "Dienststelle"("name");
|
||||
3
prisma/migrations/migration_lock.toml
Normal file
3
prisma/migrations/migration_lock.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "sqlite"
|
||||
BIN
prisma/praktika.db
Normal file
BIN
prisma/praktika.db
Normal file
Binary file not shown.
44
prisma/schema.prisma
Normal file
44
prisma/schema.prisma
Normal file
@@ -0,0 +1,44 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
output = "../src/generated/client"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "sqlite"
|
||||
url = "file:./praktika.db"
|
||||
}
|
||||
|
||||
model Dienststelle {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
anmeldungenWunsch1 Anmeldung[] @relation("Wunsch1")
|
||||
anmeldungenWunsch2 Anmeldung[] @relation("Wunsch2")
|
||||
anmeldungenWunsch3 Anmeldung[] @relation("Wunsch3")
|
||||
}
|
||||
|
||||
model Anmeldung {
|
||||
id Int @id @default(autoincrement())
|
||||
anrede String
|
||||
vorname String
|
||||
nachname String
|
||||
geburtsdatum String
|
||||
strasse String
|
||||
hausnummer String
|
||||
ort String
|
||||
plz String
|
||||
telefon String
|
||||
email String @unique
|
||||
schulart String
|
||||
zeitraum String
|
||||
motivation String
|
||||
|
||||
wunsch1Id Int
|
||||
wunsch2Id Int
|
||||
wunsch3Id Int
|
||||
|
||||
wunsch1 Dienststelle @relation("Wunsch1", fields: [wunsch1Id], references: [id])
|
||||
wunsch2 Dienststelle @relation("Wunsch2", fields: [wunsch2Id], references: [id])
|
||||
wunsch3 Dienststelle @relation("Wunsch3", fields: [wunsch3Id], references: [id])
|
||||
|
||||
timestamp DateTime @default(now())
|
||||
}
|
||||
Reference in New Issue
Block a user