@delpa/mt-prisma 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generated/client/edge.js +124 -19
- package/dist/generated/client/index-browser.js +120 -15
- package/dist/generated/client/index.d.ts +12816 -3105
- package/dist/generated/client/index.js +124 -19
- package/dist/generated/client/package.json +1 -1
- package/dist/generated/client/schema.prisma +181 -39
- package/dist/generated/generated/client/edge.js +250 -3
- package/dist/generated/generated/client/index-browser.js +260 -13
- package/dist/generated/generated/client/index.d.ts +36478 -17881
- package/dist/generated/generated/client/index.js +250 -3
- package/dist/generated/generated/client/package.json +1 -1
- package/dist/generated/generated/client/schema.prisma +335 -12
- package/generated/client/edge.js +250 -3
- package/generated/client/index-browser.js +260 -13
- package/generated/client/index.d.ts +36478 -17881
- package/generated/client/index.js +250 -3
- package/generated/client/package.json +1 -1
- package/generated/client/schema.prisma +335 -12
- package/package.json +1 -1
- package/prisma/migrations/20260122181100_add_vehicle_locations/migration.sql +67 -0
- package/prisma/migrations/20260122190951_add_forms_models/migration.sql +104 -0
- package/prisma/migrations/20260123025721_add_form_assignments/migration.sql +91 -0
- package/prisma/migrations/20260123043335_rename_assignment_to_form/migration.sql +141 -0
- package/prisma/migrations/20260123165531_add_products/migration.sql +46 -0
- package/prisma/schema.prisma +541 -232
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `template_id` on the `form_fields` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the column `assignment_id` on the `form_responses` table. All the data in the column will be lost.
|
|
6
|
+
- You are about to drop the `form_assignment_fields` table. If the table is not empty, all the data it contains will be lost.
|
|
7
|
+
- You are about to drop the `form_assignments` table. If the table is not empty, all the data it contains will be lost.
|
|
8
|
+
- Added the required column `form_id` to the `form_fields` table without a default value. This is not possible if the table is not empty.
|
|
9
|
+
|
|
10
|
+
*/
|
|
11
|
+
-- CreateEnum
|
|
12
|
+
CREATE TYPE "FormTargetType" AS ENUM ('DRIVER', 'VEHICLE', 'COMPANY_PARTNER', 'CLIENT', 'ORDER', 'ROUTE');
|
|
13
|
+
|
|
14
|
+
-- CreateEnum
|
|
15
|
+
CREATE TYPE "FormStatus" AS ENUM ('ACTIVE', 'COMPLETED', 'CANCELLED', 'EXPIRED');
|
|
16
|
+
|
|
17
|
+
-- DropForeignKey
|
|
18
|
+
ALTER TABLE "form_assignment_fields" DROP CONSTRAINT "form_assignment_fields_assignment_id_fkey";
|
|
19
|
+
|
|
20
|
+
-- DropForeignKey
|
|
21
|
+
ALTER TABLE "form_assignments" DROP CONSTRAINT "form_assignments_company_id_fkey";
|
|
22
|
+
|
|
23
|
+
-- DropForeignKey
|
|
24
|
+
ALTER TABLE "form_assignments" DROP CONSTRAINT "form_assignments_created_by_fkey";
|
|
25
|
+
|
|
26
|
+
-- DropForeignKey
|
|
27
|
+
ALTER TABLE "form_assignments" DROP CONSTRAINT "form_assignments_template_id_fkey";
|
|
28
|
+
|
|
29
|
+
-- DropForeignKey
|
|
30
|
+
ALTER TABLE "form_fields" DROP CONSTRAINT "form_fields_template_id_fkey";
|
|
31
|
+
|
|
32
|
+
-- DropForeignKey
|
|
33
|
+
ALTER TABLE "form_responses" DROP CONSTRAINT "form_responses_assignment_id_fkey";
|
|
34
|
+
|
|
35
|
+
-- DropIndex
|
|
36
|
+
DROP INDEX "form_fields_template_id_idx";
|
|
37
|
+
|
|
38
|
+
-- DropIndex
|
|
39
|
+
DROP INDEX "form_responses_assignment_id_idx";
|
|
40
|
+
|
|
41
|
+
-- AlterTable
|
|
42
|
+
ALTER TABLE "form_fields" DROP COLUMN "template_id",
|
|
43
|
+
ADD COLUMN "form_id" UUID NOT NULL,
|
|
44
|
+
ADD COLUMN "source_field_id" UUID;
|
|
45
|
+
|
|
46
|
+
-- AlterTable
|
|
47
|
+
ALTER TABLE "form_responses" DROP COLUMN "assignment_id",
|
|
48
|
+
ADD COLUMN "form_id" UUID;
|
|
49
|
+
|
|
50
|
+
-- DropTable
|
|
51
|
+
DROP TABLE "form_assignment_fields";
|
|
52
|
+
|
|
53
|
+
-- DropTable
|
|
54
|
+
DROP TABLE "form_assignments";
|
|
55
|
+
|
|
56
|
+
-- DropEnum
|
|
57
|
+
DROP TYPE "AssignmentTargetType";
|
|
58
|
+
|
|
59
|
+
-- DropEnum
|
|
60
|
+
DROP TYPE "FormAssignmentStatus";
|
|
61
|
+
|
|
62
|
+
-- CreateTable
|
|
63
|
+
CREATE TABLE "template_fields" (
|
|
64
|
+
"id" UUID NOT NULL,
|
|
65
|
+
"template_id" UUID NOT NULL,
|
|
66
|
+
"label" TEXT NOT NULL,
|
|
67
|
+
"field_type" "FieldType" NOT NULL,
|
|
68
|
+
"placeholder" TEXT,
|
|
69
|
+
"help_text" TEXT,
|
|
70
|
+
"is_required" BOOLEAN NOT NULL DEFAULT false,
|
|
71
|
+
"order" INTEGER NOT NULL DEFAULT 0,
|
|
72
|
+
"options" JSONB,
|
|
73
|
+
"validations" JSONB,
|
|
74
|
+
"default_value" TEXT,
|
|
75
|
+
"conditional_logic" JSONB,
|
|
76
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
77
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
78
|
+
|
|
79
|
+
CONSTRAINT "template_fields_pkey" PRIMARY KEY ("id")
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
-- CreateTable
|
|
83
|
+
CREATE TABLE "forms" (
|
|
84
|
+
"id" UUID NOT NULL,
|
|
85
|
+
"name" TEXT NOT NULL,
|
|
86
|
+
"description" TEXT,
|
|
87
|
+
"template_id" UUID,
|
|
88
|
+
"company_id" UUID,
|
|
89
|
+
"target_type" "FormTargetType" NOT NULL,
|
|
90
|
+
"target_ids" UUID[],
|
|
91
|
+
"is_required" BOOLEAN NOT NULL DEFAULT false,
|
|
92
|
+
"due_date" TIMESTAMP(3),
|
|
93
|
+
"status" "FormStatus" NOT NULL DEFAULT 'ACTIVE',
|
|
94
|
+
"created_by" UUID,
|
|
95
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
96
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
97
|
+
|
|
98
|
+
CONSTRAINT "forms_pkey" PRIMARY KEY ("id")
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
-- CreateIndex
|
|
102
|
+
CREATE INDEX "template_fields_template_id_idx" ON "template_fields"("template_id");
|
|
103
|
+
|
|
104
|
+
-- CreateIndex
|
|
105
|
+
CREATE INDEX "forms_company_id_idx" ON "forms"("company_id");
|
|
106
|
+
|
|
107
|
+
-- CreateIndex
|
|
108
|
+
CREATE INDEX "forms_template_id_idx" ON "forms"("template_id");
|
|
109
|
+
|
|
110
|
+
-- CreateIndex
|
|
111
|
+
CREATE INDEX "forms_target_type_idx" ON "forms"("target_type");
|
|
112
|
+
|
|
113
|
+
-- CreateIndex
|
|
114
|
+
CREATE INDEX "forms_status_idx" ON "forms"("status");
|
|
115
|
+
|
|
116
|
+
-- CreateIndex
|
|
117
|
+
CREATE INDEX "forms_due_date_idx" ON "forms"("due_date");
|
|
118
|
+
|
|
119
|
+
-- CreateIndex
|
|
120
|
+
CREATE INDEX "form_fields_form_id_idx" ON "form_fields"("form_id");
|
|
121
|
+
|
|
122
|
+
-- CreateIndex
|
|
123
|
+
CREATE INDEX "form_responses_form_id_idx" ON "form_responses"("form_id");
|
|
124
|
+
|
|
125
|
+
-- AddForeignKey
|
|
126
|
+
ALTER TABLE "template_fields" ADD CONSTRAINT "template_fields_template_id_fkey" FOREIGN KEY ("template_id") REFERENCES "form_templates"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
127
|
+
|
|
128
|
+
-- AddForeignKey
|
|
129
|
+
ALTER TABLE "form_responses" ADD CONSTRAINT "form_responses_form_id_fkey" FOREIGN KEY ("form_id") REFERENCES "forms"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
130
|
+
|
|
131
|
+
-- AddForeignKey
|
|
132
|
+
ALTER TABLE "forms" ADD CONSTRAINT "forms_template_id_fkey" FOREIGN KEY ("template_id") REFERENCES "form_templates"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
133
|
+
|
|
134
|
+
-- AddForeignKey
|
|
135
|
+
ALTER TABLE "forms" ADD CONSTRAINT "forms_company_id_fkey" FOREIGN KEY ("company_id") REFERENCES "companies"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
136
|
+
|
|
137
|
+
-- AddForeignKey
|
|
138
|
+
ALTER TABLE "forms" ADD CONSTRAINT "forms_created_by_fkey" FOREIGN KEY ("created_by") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
139
|
+
|
|
140
|
+
-- AddForeignKey
|
|
141
|
+
ALTER TABLE "form_fields" ADD CONSTRAINT "form_fields_form_id_fkey" FOREIGN KEY ("form_id") REFERENCES "forms"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "PackagingType" AS ENUM ('BOX', 'PALLET', 'CRATE', 'BARREL', 'BAG', 'ROLL', 'BUNDLE', 'CONTAINER', 'LOOSE', 'OTHER');
|
|
3
|
+
|
|
4
|
+
-- CreateEnum
|
|
5
|
+
CREATE TYPE "ProductCategory" AS ENUM ('ELECTRONICS', 'FOOD_BEVERAGE', 'PHARMACEUTICALS', 'TEXTILES', 'MACHINERY', 'CHEMICALS', 'CONSTRUCTION', 'AUTOMOTIVE', 'AGRICULTURE', 'FURNITURE', 'PAPER', 'PLASTICS', 'METALS', 'GLASS', 'OTHER');
|
|
6
|
+
|
|
7
|
+
-- CreateEnum
|
|
8
|
+
CREATE TYPE "ProductSubcategory" AS ENUM ('RAW_MATERIALS', 'FINISHED_GOODS', 'SEMI_FINISHED', 'SPARE_PARTS', 'CONSUMABLES', 'HAZARDOUS', 'FRAGILE', 'PERISHABLE', 'REFRIGERATED', 'FROZEN', 'BULK', 'LIQUID', 'OVERSIZED', 'HIGH_VALUE', 'OTHER');
|
|
9
|
+
|
|
10
|
+
-- CreateTable
|
|
11
|
+
CREATE TABLE "products" (
|
|
12
|
+
"id" UUID NOT NULL,
|
|
13
|
+
"client_id" UUID NOT NULL,
|
|
14
|
+
"description" TEXT NOT NULL,
|
|
15
|
+
"sku" TEXT NOT NULL,
|
|
16
|
+
"quantity" INTEGER NOT NULL DEFAULT 0,
|
|
17
|
+
"packaging_type" "PackagingType" NOT NULL DEFAULT 'BOX',
|
|
18
|
+
"category" "ProductCategory" NOT NULL DEFAULT 'OTHER',
|
|
19
|
+
"subcategory" "ProductSubcategory" NOT NULL DEFAULT 'OTHER',
|
|
20
|
+
"dimension_unit" "DimensionUnits" NOT NULL DEFAULT 'CM',
|
|
21
|
+
"length" DOUBLE PRECISION,
|
|
22
|
+
"width" DOUBLE PRECISION,
|
|
23
|
+
"height" DOUBLE PRECISION,
|
|
24
|
+
"weight_unit" "WeightUnits" NOT NULL DEFAULT 'KG',
|
|
25
|
+
"weight" DOUBLE PRECISION,
|
|
26
|
+
"is_active" BOOLEAN NOT NULL DEFAULT true,
|
|
27
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
28
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
29
|
+
|
|
30
|
+
CONSTRAINT "products_pkey" PRIMARY KEY ("id")
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
-- CreateIndex
|
|
34
|
+
CREATE UNIQUE INDEX "products_sku_key" ON "products"("sku");
|
|
35
|
+
|
|
36
|
+
-- CreateIndex
|
|
37
|
+
CREATE INDEX "products_client_id_idx" ON "products"("client_id");
|
|
38
|
+
|
|
39
|
+
-- CreateIndex
|
|
40
|
+
CREATE INDEX "products_sku_idx" ON "products"("sku");
|
|
41
|
+
|
|
42
|
+
-- CreateIndex
|
|
43
|
+
CREATE INDEX "products_category_idx" ON "products"("category");
|
|
44
|
+
|
|
45
|
+
-- AddForeignKey
|
|
46
|
+
ALTER TABLE "products" ADD CONSTRAINT "products_client_id_fkey" FOREIGN KEY ("client_id") REFERENCES "clients"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|