mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 13:25:18 +00:00
fix: field inconsistent order
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
-- RedefineTables
|
||||||
|
PRAGMA defer_foreign_keys=ON;
|
||||||
|
PRAGMA foreign_keys=OFF;
|
||||||
|
CREATE TABLE "new_fields" (
|
||||||
|
"code" TEXT NOT NULL PRIMARY KEY,
|
||||||
|
"name" TEXT NOT NULL,
|
||||||
|
"type" TEXT NOT NULL DEFAULT 'string',
|
||||||
|
"llm_prompt" TEXT,
|
||||||
|
"options" JSONB,
|
||||||
|
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"is_visible_in_list" BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
"is_visible_in_analysis" BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
"is_required" BOOLEAN NOT NULL DEFAULT false,
|
||||||
|
"is_extra" BOOLEAN NOT NULL DEFAULT true
|
||||||
|
);
|
||||||
|
INSERT INTO "new_fields" ("code", "is_extra", "is_required", "is_visible_in_analysis", "is_visible_in_list", "llm_prompt", "name", "options", "type") SELECT "code", "is_extra", "is_required", "is_visible_in_analysis", "is_visible_in_list", "llm_prompt", "name", "options", "type" FROM "fields";
|
||||||
|
DROP TABLE "fields";
|
||||||
|
ALTER TABLE "new_fields" RENAME TO "fields";
|
||||||
|
PRAGMA foreign_keys=ON;
|
||||||
|
PRAGMA defer_foreign_keys=OFF;
|
||||||
@@ -42,15 +42,16 @@ model Project {
|
|||||||
}
|
}
|
||||||
|
|
||||||
model Field {
|
model Field {
|
||||||
code String @id
|
code String @id
|
||||||
name String
|
name String
|
||||||
type String @default("string")
|
type String @default("string")
|
||||||
llm_prompt String?
|
llm_prompt String?
|
||||||
options Json?
|
options Json?
|
||||||
isVisibleInList Boolean @default(false) @map("is_visible_in_list")
|
createdAt DateTime @default(now()) @map("created_at")
|
||||||
isVisibleInAnalysis Boolean @default(false) @map("is_visible_in_analysis")
|
isVisibleInList Boolean @default(false) @map("is_visible_in_list")
|
||||||
isRequired Boolean @default(false) @map("is_required")
|
isVisibleInAnalysis Boolean @default(false) @map("is_visible_in_analysis")
|
||||||
isExtra Boolean @default(true) @map("is_extra")
|
isRequired Boolean @default(false) @map("is_required")
|
||||||
|
isExtra Boolean @default(true) @map("is_extra")
|
||||||
|
|
||||||
@@map("fields")
|
@@map("fields")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,10 +332,10 @@ const fields = [
|
|||||||
isExtra: false,
|
isExtra: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: "categoryCode",
|
code: "issuedAt",
|
||||||
name: "Category",
|
name: "Issued At",
|
||||||
type: "string",
|
type: "string",
|
||||||
llm_prompt: "category code, one of: {categories.code}",
|
llm_prompt: "issued at date (YYYY-MM-DD format)",
|
||||||
isVisibleInList: true,
|
isVisibleInList: true,
|
||||||
isVisibleInAnalysis: true,
|
isVisibleInAnalysis: true,
|
||||||
isRequired: false,
|
isRequired: false,
|
||||||
@@ -352,10 +352,20 @@ const fields = [
|
|||||||
isExtra: false,
|
isExtra: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
code: "issuedAt",
|
code: "categoryCode",
|
||||||
name: "Issued At",
|
name: "Category",
|
||||||
type: "string",
|
type: "string",
|
||||||
llm_prompt: "issued at date (YYYY-MM-DD format)",
|
llm_prompt: "category code, one of: {categories.code}",
|
||||||
|
isVisibleInList: true,
|
||||||
|
isVisibleInAnalysis: true,
|
||||||
|
isRequired: false,
|
||||||
|
isExtra: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
code: "files",
|
||||||
|
name: "Files",
|
||||||
|
type: "string",
|
||||||
|
llm_prompt: "",
|
||||||
isVisibleInList: true,
|
isVisibleInList: true,
|
||||||
isVisibleInAnalysis: true,
|
isVisibleInAnalysis: true,
|
||||||
isRequired: false,
|
isRequired: false,
|
||||||
@@ -483,6 +493,13 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Seed fields
|
// Seed fields
|
||||||
|
await prisma.field.deleteMany({
|
||||||
|
where: {
|
||||||
|
code: {
|
||||||
|
in: fields.map((field) => field.code),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
for (const field of fields) {
|
for (const field of fields) {
|
||||||
await prisma.field.upsert({
|
await prisma.field.upsert({
|
||||||
where: { code: field.code },
|
where: { code: field.code },
|
||||||
|
|||||||
Reference in New Issue
Block a user