This commit is contained in:
Oscar
2026-05-26 10:14:26 +03:00
commit 1f1633de8a
39 changed files with 10534 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
-- CreateTable
CREATE TABLE "User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"telegramId" BIGINT NOT NULL,
"username" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- CreateIndex
CREATE UNIQUE INDEX "User_telegramId_key" ON "User"("telegramId");

View File

@@ -0,0 +1,16 @@
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"telegramId" BIGINT NOT NULL,
"username" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"isNew" BOOLEAN NOT NULL DEFAULT true
);
INSERT INTO "new_User" ("createdAt", "id", "telegramId", "username") SELECT "createdAt", "id", "telegramId", "username" FROM "User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE UNIQUE INDEX "User_telegramId_key" ON "User"("telegramId");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "firstName" TEXT;

View File

@@ -0,0 +1,23 @@
/*
Warnings:
- You are about to drop the column `isNew` on the `User` table. All the data in the column will be lost.
*/
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"telegramId" BIGINT NOT NULL,
"username" TEXT,
"firstName" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"session" TEXT
);
INSERT INTO "new_User" ("createdAt", "firstName", "id", "telegramId", "username") SELECT "createdAt", "firstName", "id", "telegramId", "username" FROM "User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE UNIQUE INDEX "User_telegramId_key" ON "User"("telegramId");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;

View File

@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "User" ADD COLUMN "hhEmail" TEXT;

View File

@@ -0,0 +1,7 @@
-- CreateTable
CREATE TABLE "Resume" (
"id" TEXT NOT NULL PRIMARY KEY,
"data" TEXT NOT NULL,
"telegramId" BIGINT NOT NULL,
CONSTRAINT "Resume_telegramId_fkey" FOREIGN KEY ("telegramId") REFERENCES "User" ("telegramId") ON DELETE CASCADE ON UPDATE CASCADE
);

View File

@@ -0,0 +1,19 @@
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_User" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"telegramId" BIGINT NOT NULL,
"username" TEXT,
"firstName" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"session" TEXT,
"hhEmail" TEXT,
"prompt" TEXT NOT NULL DEFAULT 'Напиши сопроводительное письмо опираясь на резюме. Пиши грамотно и коротко, простым языком не официально. Пиши только текст самого письма, ты пишешь напрямую в компанию. Мне отвечать или делать ремарки не нужно.'
);
INSERT INTO "new_User" ("createdAt", "firstName", "hhEmail", "id", "session", "telegramId", "username") SELECT "createdAt", "firstName", "hhEmail", "id", "session", "telegramId", "username" FROM "User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE UNIQUE INDEX "User_telegramId_key" ON "User"("telegramId");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;

View File

@@ -0,0 +1,8 @@
-- CreateTable
CREATE TABLE "Settings" (
"id" TEXT NOT NULL PRIMARY KEY,
"telegramId" BIGINT NOT NULL,
"searchQuery" TEXT NOT NULL DEFAULT 'Vue',
"maxApplies" INTEGER NOT NULL DEFAULT 1,
CONSTRAINT "Settings_telegramId_fkey" FOREIGN KEY ("telegramId") REFERENCES "User" ("telegramId") ON DELETE CASCADE ON UPDATE CASCADE
);

View File

@@ -0,0 +1,21 @@
/*
Warnings:
- The primary key for the `Settings` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `id` on the `Settings` table. All the data in the column will be lost.
*/
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Settings" (
"telegramId" BIGINT NOT NULL PRIMARY KEY,
"searchQuery" TEXT NOT NULL DEFAULT 'Vue',
"maxApplies" INTEGER NOT NULL DEFAULT 1,
CONSTRAINT "Settings_telegramId_fkey" FOREIGN KEY ("telegramId") REFERENCES "User" ("telegramId") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_Settings" ("maxApplies", "searchQuery", "telegramId") SELECT "maxApplies", "searchQuery", "telegramId" FROM "Settings";
DROP TABLE "Settings";
ALTER TABLE "new_Settings" RENAME TO "Settings";
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;

View 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"

42
prisma/schema.prisma Normal file
View File

@@ -0,0 +1,42 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
// output = "../src/generated/prisma"
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
telegramId BigInt @unique
username String?
firstName String?
createdAt DateTime @default(now())
session String?
hhEmail String?
resumes Resume[]
prompt String @default("Напиши сопроводительное письмо опираясь на резюме. Пиши грамотно и коротко, простым языком не официально. Пиши только текст самого письма, ты пишешь напрямую в компанию. Мне отвечать или делать ремарки не нужно.")
Settings Settings?
}
model Resume {
id String @id
user User @relation(references: [telegramId], fields: [telegramId], onDelete: Cascade)
data String
telegramId BigInt
}
model Settings {
telegramId BigInt @id
user User @relation(references: [telegramId], fields: [telegramId], onDelete: Cascade)
searchQuery String @default("Vue")
maxApplies Int @default(1)
}