Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for user-ticket requirements on purchase order creation #324

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions drizzle/migrations/0039_perpetual_sway.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CREATE TABLE IF NOT EXISTS "ticket_requirements" (
"ticket_id" uuid NOT NULL,
"required_ticket_id" uuid NOT NULL,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SI tenemos requirement_type creo que este ID es complicado! Al menos que tengamos un campo adicional para required_category_id

"requirement_type" text NOT NULL,
"description" text,
"created_at" timestamp (6) DEFAULT now() NOT NULL,
"updated_at" timestamp (6),
"deleted_at" timestamp (6)
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "ticket_requirements" ADD CONSTRAINT "ticket_requirements_ticket_id_tickets_id_fk" FOREIGN KEY ("ticket_id") REFERENCES "public"."tickets"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "ticket_requirements" ADD CONSTRAINT "ticket_requirements_required_ticket_id_tickets_id_fk" FOREIGN KEY ("required_ticket_id") REFERENCES "public"."tickets"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "unique_ticket_requirement" ON "ticket_requirements" USING btree ("ticket_id","required_ticket_id");
Loading
Loading