feat(forklifts): added backend forklift stuff and frontend companies
This commit is contained in:
60
migrations/0028_brown_praxagora.sql
Normal file
60
migrations/0028_brown_praxagora.sql
Normal file
@@ -0,0 +1,60 @@
|
||||
CREATE TABLE "forklift_companies" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"name" text NOT NULL,
|
||||
CONSTRAINT "forklift_companies_name_unique" UNIQUE("name")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "leases" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"lease_number" text NOT NULL,
|
||||
"company_id" uuid,
|
||||
"start_date" date,
|
||||
"end_date" date,
|
||||
"lease_link" text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "lease_invoice_forklifts" (
|
||||
"id" serial PRIMARY KEY NOT NULL,
|
||||
"invoice_id" uuid NOT NULL,
|
||||
"forklift_id" uuid NOT NULL,
|
||||
"amount" numeric
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "forklifts" (
|
||||
"forklift_id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"forklift_number" serial NOT NULL,
|
||||
"serial_number" text NOT NULL,
|
||||
"model" text NOT NULL,
|
||||
"plant" text NOT NULL,
|
||||
"forklift_status" "forklift_status" DEFAULT 'active',
|
||||
"gl_code" integer NOT NULL,
|
||||
"profit_center" integer NOT NULL,
|
||||
"manufacturer" text NOT NULL,
|
||||
"manufacturer_year" text NOT NULL,
|
||||
"engine" text NOT NULL,
|
||||
"battery_type" text NOT NULL,
|
||||
"lease_id" uuid,
|
||||
"data_plate" text,
|
||||
"add_date" timestamp DEFAULT now(),
|
||||
"add_user" text DEFAULT 'LST'
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "lease_invoices" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"lease_id" uuid NOT NULL,
|
||||
"company_id" uuid,
|
||||
"invoice_number" text NOT NULL,
|
||||
"invoice_date" date NOT NULL,
|
||||
"forklift_id" uuid NOT NULL,
|
||||
"total_amount" numeric,
|
||||
"uploaded_by" text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "leases" ADD CONSTRAINT "leases_company_id_forklift_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."forklift_companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "lease_invoice_forklifts" ADD CONSTRAINT "lease_invoice_forklifts_invoice_id_lease_invoices_id_fk" FOREIGN KEY ("invoice_id") REFERENCES "public"."lease_invoices"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "lease_invoice_forklifts" ADD CONSTRAINT "lease_invoice_forklifts_forklift_id_forklifts_forklift_id_fk" FOREIGN KEY ("forklift_id") REFERENCES "public"."forklifts"("forklift_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "forklifts" ADD CONSTRAINT "forklifts_plant_serverData_name_fk" FOREIGN KEY ("plant") REFERENCES "public"."serverData"("name") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "forklifts" ADD CONSTRAINT "forklifts_lease_id_leases_id_fk" FOREIGN KEY ("lease_id") REFERENCES "public"."leases"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "lease_invoices" ADD CONSTRAINT "lease_invoices_lease_id_leases_id_fk" FOREIGN KEY ("lease_id") REFERENCES "public"."leases"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "lease_invoices" ADD CONSTRAINT "lease_invoices_company_id_forklift_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."forklift_companies"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE "lease_invoices" ADD CONSTRAINT "lease_invoices_forklift_id_forklifts_forklift_id_fk" FOREIGN KEY ("forklift_id") REFERENCES "public"."forklifts"("forklift_id") ON DELETE cascade ON UPDATE no action;
|
||||
2
migrations/0029_rapid_wallow.sql
Normal file
2
migrations/0029_rapid_wallow.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE "forklifts" ALTER COLUMN "forklift_status" SET DATA TYPE text;--> statement-breakpoint
|
||||
ALTER TABLE "forklifts" ALTER COLUMN "forklift_status" SET DEFAULT 'active';
|
||||
1
migrations/0030_flawless_talisman.sql
Normal file
1
migrations/0030_flawless_talisman.sql
Normal file
@@ -0,0 +1 @@
|
||||
CREATE UNIQUE INDEX "plant_name" ON "serverData" USING btree ("name");
|
||||
4
migrations/0031_red_bug.sql
Normal file
4
migrations/0031_red_bug.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE "forklifts" DROP CONSTRAINT "forklifts_plant_serverData_name_fk";
|
||||
--> statement-breakpoint
|
||||
DROP INDEX "plant_name";--> statement-breakpoint
|
||||
ALTER TABLE "forklifts" ADD CONSTRAINT "forklifts_plant_serverData_server_id_fk" FOREIGN KEY ("plant") REFERENCES "public"."serverData"("server_id") ON DELETE set null ON UPDATE no action;
|
||||
4
migrations/0032_eminent_james_howlett.sql
Normal file
4
migrations/0032_eminent_james_howlett.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE "forklifts" DROP CONSTRAINT "forklifts_plant_serverData_server_id_fk";
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "serverData" ADD CONSTRAINT "serverData_name_unique" UNIQUE("name");
|
||||
ALTER TABLE "forklifts" ADD CONSTRAINT "forklifts_plant_serverData_name_fk" FOREIGN KEY ("plant") REFERENCES "public"."serverData"("name") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
|
||||
3
migrations/0033_luxuriant_marvel_zombies.sql
Normal file
3
migrations/0033_luxuriant_marvel_zombies.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE "forklifts" DROP CONSTRAINT "forklifts_plant_serverData_name_fk";
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "forklifts" ADD CONSTRAINT "forklifts_plant_serverData_server_id_fk" FOREIGN KEY ("plant") REFERENCES "public"."serverData"("server_id") ON DELETE set null ON UPDATE no action;
|
||||
3
migrations/0034_living_war_machine.sql
Normal file
3
migrations/0034_living_war_machine.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE "forklifts" DROP CONSTRAINT "forklifts_plant_serverData_server_id_fk";
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE "forklifts" ADD CONSTRAINT "forklifts_plant_serverData_name_fk" FOREIGN KEY ("plant") REFERENCES "public"."serverData"("name") ON DELETE set null ON UPDATE no action;
|
||||
3
migrations/0035_overrated_ben_parker.sql
Normal file
3
migrations/0035_overrated_ben_parker.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE "forklift_companies" ADD COLUMN "active" boolean DEFAULT true;--> statement-breakpoint
|
||||
ALTER TABLE "forklift_companies" ADD COLUMN "add_date" timestamp DEFAULT now();--> statement-breakpoint
|
||||
ALTER TABLE "forklift_companies" ADD COLUMN "add_user" text DEFAULT 'LST';
|
||||
2
migrations/0036_sticky_brood.sql
Normal file
2
migrations/0036_sticky_brood.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE "forklift_companies" ADD COLUMN "upd_date" timestamp DEFAULT now();--> statement-breakpoint
|
||||
ALTER TABLE "forklift_companies" ADD COLUMN "upd_user" text DEFAULT 'LST';
|
||||
2138
migrations/meta/0028_snapshot.json
Normal file
2138
migrations/meta/0028_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2137
migrations/meta/0029_snapshot.json
Normal file
2137
migrations/meta/0029_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2152
migrations/meta/0030_snapshot.json
Normal file
2152
migrations/meta/0030_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2137
migrations/meta/0031_snapshot.json
Normal file
2137
migrations/meta/0031_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2145
migrations/meta/0032_snapshot.json
Normal file
2145
migrations/meta/0032_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2145
migrations/meta/0033_snapshot.json
Normal file
2145
migrations/meta/0033_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2145
migrations/meta/0034_snapshot.json
Normal file
2145
migrations/meta/0034_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2166
migrations/meta/0035_snapshot.json
Normal file
2166
migrations/meta/0035_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2180
migrations/meta/0036_snapshot.json
Normal file
2180
migrations/meta/0036_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -197,6 +197,69 @@
|
||||
"when": 1761938877395,
|
||||
"tag": "0027_special_harpoon",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 28,
|
||||
"version": "7",
|
||||
"when": 1762110963295,
|
||||
"tag": "0028_brown_praxagora",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 29,
|
||||
"version": "7",
|
||||
"when": 1762111060465,
|
||||
"tag": "0029_rapid_wallow",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 30,
|
||||
"version": "7",
|
||||
"when": 1762111106977,
|
||||
"tag": "0030_flawless_talisman",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 31,
|
||||
"version": "7",
|
||||
"when": 1762111262895,
|
||||
"tag": "0031_red_bug",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 32,
|
||||
"version": "7",
|
||||
"when": 1762111388336,
|
||||
"tag": "0032_eminent_james_howlett",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 33,
|
||||
"version": "7",
|
||||
"when": 1762111567029,
|
||||
"tag": "0033_luxuriant_marvel_zombies",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 34,
|
||||
"version": "7",
|
||||
"when": 1762111614977,
|
||||
"tag": "0034_living_war_machine",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 35,
|
||||
"version": "7",
|
||||
"when": 1762112218732,
|
||||
"tag": "0035_overrated_ben_parker",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 36,
|
||||
"version": "7",
|
||||
"when": 1762112909957,
|
||||
"tag": "0036_sticky_brood",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user