This commit is contained in:
jackbeeby
2025-03-31 16:13:56 +11:00
parent d8773925e8
commit 0b9d543d36
22 changed files with 3203 additions and 32 deletions

BIN
prisma/dev.db Normal file

Binary file not shown.

View File

@@ -0,0 +1,44 @@
-- CreateTable
CREATE TABLE "Account" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"type" BIGINT,
"firstName" BIGINT,
"lastName" BIGINT,
"email" BIGINT,
"phone" BIGINT,
"company" BIGINT,
"password" BIGINT
);
-- CreateTable
CREATE TABLE "JobPost" (
"id" BIGINT NOT NULL PRIMARY KEY,
"businessId" INTEGER,
"heading" BIGINT,
"description" BIGINT,
"locationText" BIGINT,
"locationLongLat" BIGINT,
"field" BIGINT,
"contractType" BIGINT,
"payRange" BIGINT,
"hours" BIGINT,
"createdAt" BIGINT,
"endingAtTime" BIGINT
);
-- CreateTable
CREATE TABLE "AccountInformation" (
"id" BIGINT NOT NULL PRIMARY KEY,
"sex" BIGINT,
"age" BIGINT,
"suburb" BIGINT,
"postcode" BIGINT,
"state" BIGINT,
"searchPostcode" BIGINT,
"searchRadius" BIGINT,
"accountId" INTEGER NOT NULL,
CONSTRAINT "AccountInformation_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "AccountInformation_accountId_key" ON "AccountInformation"("accountId");

View File

@@ -0,0 +1,43 @@
/*
Warnings:
- You are about to alter the column `phone` on the `Account` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- The primary key for the `AccountInformation` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to alter the column `age` on the `AccountInformation` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `id` on the `AccountInformation` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
*/
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Account" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"type" TEXT,
"firstName" TEXT,
"lastName" TEXT,
"email" TEXT,
"phone" INTEGER,
"company" TEXT,
"password" TEXT
);
INSERT INTO "new_Account" ("company", "email", "firstName", "id", "lastName", "password", "phone", "type") SELECT "company", "email", "firstName", "id", "lastName", "password", "phone", "type" FROM "Account";
DROP TABLE "Account";
ALTER TABLE "new_Account" RENAME TO "Account";
CREATE TABLE "new_AccountInformation" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"sex" TEXT,
"age" INTEGER,
"suburb" BIGINT,
"postcode" BIGINT,
"state" BIGINT,
"searchPostcode" BIGINT,
"searchRadius" BIGINT,
"accountId" INTEGER NOT NULL,
CONSTRAINT "AccountInformation_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "Account" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_AccountInformation" ("accountId", "age", "id", "postcode", "searchPostcode", "searchRadius", "sex", "state", "suburb") SELECT "accountId", "age", "id", "postcode", "searchPostcode", "searchRadius", "sex", "state", "suburb" FROM "AccountInformation";
DROP TABLE "AccountInformation";
ALTER TABLE "new_AccountInformation" RENAME TO "AccountInformation";
CREATE UNIQUE INDEX "AccountInformation_accountId_key" ON "AccountInformation"("accountId");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;

View File

@@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[email]` on the table `Account` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "Account_email_key" ON "Account"("email");

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"

55
prisma/schema.prisma Normal file
View File

@@ -0,0 +1,55 @@
// 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
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model Account {
id Int @id @default(autoincrement())
type String?
firstName String?
lastName String?
email String? @unique
phone Int?
company String?
password String?
accountInformation AccountInformation?
}
model JobPost {
id BigInt @id @default(autoincrement())
businessId Int?
heading BigInt?
description BigInt?
locationText BigInt?
locationLongLat BigInt?
field BigInt?
contractType BigInt?
payRange BigInt?
hours BigInt?
createdAt BigInt?
endingAtTime BigInt?
}
model AccountInformation {
id Int @id @default(autoincrement())
sex String?
age Int?
suburb BigInt?
postcode BigInt?
state BigInt?
searchPostcode BigInt?
searchRadius BigInt?
accountId Int @unique // Add the unique constraint here
account Account @relation(fields: [accountId], references: [id])
}