first commit
This commit is contained in:
38
prisma/migrations/20260531102503_init/migration.sql
Normal file
38
prisma/migrations/20260531102503_init/migration.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE `Product` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`barcode` VARCHAR(191) NOT NULL,
|
||||
`name` VARCHAR(191) NOT NULL,
|
||||
`cleanName` VARCHAR(191) NOT NULL,
|
||||
`amountRaw` VARCHAR(191) NULL,
|
||||
`amount` DOUBLE NULL,
|
||||
`unit` VARCHAR(191) NULL,
|
||||
`image` VARCHAR(1000) NULL,
|
||||
`category` VARCHAR(191) NULL,
|
||||
`subcategory` VARCHAR(191) NULL,
|
||||
`company` VARCHAR(191) NULL,
|
||||
`url` VARCHAR(500) NOT NULL,
|
||||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
`updatedAt` DATETIME(3) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `Product_barcode_key`(`barcode`),
|
||||
UNIQUE INDEX `Product_url_key`(`url`),
|
||||
INDEX `Product_barcode_idx`(`barcode`),
|
||||
INDEX `Product_name_idx`(`name`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE `ScrapeQueue` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`url` VARCHAR(500) NOT NULL,
|
||||
`status` VARCHAR(191) NOT NULL DEFAULT 'pending',
|
||||
`error` TEXT NULL,
|
||||
`retryCount` INTEGER NOT NULL DEFAULT 0,
|
||||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
`updatedAt` DATETIME(3) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `ScrapeQueue_url_key`(`url`),
|
||||
INDEX `ScrapeQueue_status_idx`(`status`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
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 (i.e. Git)
|
||||
provider = "mysql"
|
||||
40
prisma/schema.prisma
Normal file
40
prisma/schema.prisma
Normal file
@@ -0,0 +1,40 @@
|
||||
datasource db {
|
||||
provider = "mysql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
model Product {
|
||||
id Int @id @default(autoincrement())
|
||||
barcode String @unique
|
||||
name String
|
||||
cleanName String
|
||||
amountRaw String?
|
||||
amount Float?
|
||||
unit String?
|
||||
image String? @db.VarChar(1000)
|
||||
category String?
|
||||
subcategory String?
|
||||
company String?
|
||||
url String @unique @db.VarChar(500)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([barcode])
|
||||
@@index([name])
|
||||
}
|
||||
|
||||
model ScrapeQueue {
|
||||
id Int @id @default(autoincrement())
|
||||
url String @unique @db.VarChar(500)
|
||||
status String @default("pending") // pending, processing, completed, failed
|
||||
error String? @db.Text
|
||||
retryCount Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([status])
|
||||
}
|
||||
Reference in New Issue
Block a user