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;
|
||||
@@ -47,6 +47,7 @@ model Field {
|
||||
type String @default("string")
|
||||
llm_prompt String?
|
||||
options Json?
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
isVisibleInList Boolean @default(false) @map("is_visible_in_list")
|
||||
isVisibleInAnalysis Boolean @default(false) @map("is_visible_in_analysis")
|
||||
isRequired Boolean @default(false) @map("is_required")
|
||||
|
||||
@@ -332,10 +332,10 @@ const fields = [
|
||||
isExtra: false,
|
||||
},
|
||||
{
|
||||
code: "categoryCode",
|
||||
name: "Category",
|
||||
code: "issuedAt",
|
||||
name: "Issued At",
|
||||
type: "string",
|
||||
llm_prompt: "category code, one of: {categories.code}",
|
||||
llm_prompt: "issued at date (YYYY-MM-DD format)",
|
||||
isVisibleInList: true,
|
||||
isVisibleInAnalysis: true,
|
||||
isRequired: false,
|
||||
@@ -352,10 +352,20 @@ const fields = [
|
||||
isExtra: false,
|
||||
},
|
||||
{
|
||||
code: "issuedAt",
|
||||
name: "Issued At",
|
||||
code: "categoryCode",
|
||||
name: "Category",
|
||||
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,
|
||||
isVisibleInAnalysis: true,
|
||||
isRequired: false,
|
||||
@@ -483,6 +493,13 @@ async function main() {
|
||||
}
|
||||
|
||||
// Seed fields
|
||||
await prisma.field.deleteMany({
|
||||
where: {
|
||||
code: {
|
||||
in: fields.map((field) => field.code),
|
||||
},
|
||||
},
|
||||
})
|
||||
for (const field of fields) {
|
||||
await prisma.field.upsert({
|
||||
where: { code: field.code },
|
||||
|
||||
Reference in New Issue
Block a user