CREATE TABLE "functions" ( "id" text PRIMARY KEY NOT NULL, "slug" text NOT NULL, "name" text NOT NULL, "category_id" text NOT NULL, "description" text, "sort_order" integer DEFAULT 0 NOT NULL, "active" boolean DEFAULT true NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone, CONSTRAINT "functions_slug_unique" UNIQUE("slug") ); --> statement-breakpoint CREATE TABLE "skill_categories" ( "id" text PRIMARY KEY NOT NULL, "slug" text NOT NULL, "name" text NOT NULL, "description" text, "color_hex" text, "icon" text, "sort_order" integer DEFAULT 0 NOT NULL, "active" boolean DEFAULT true NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone, CONSTRAINT "skill_categories_slug_unique" UNIQUE("slug") ); --> statement-breakpoint CREATE TABLE "technologies" ( "id" text PRIMARY KEY NOT NULL, "slug" text NOT NULL, "name" text NOT NULL, "vendor_id" text NOT NULL, "category_id" text NOT NULL, "model_number" text, "version_label" text, "docs_url" text, "purchased_on" date, "serial_number" text, "retired_at" timestamp with time zone, "successor_technology_id" text, "sort_order" integer DEFAULT 0 NOT NULL, "active" boolean DEFAULT true NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone, CONSTRAINT "technologies_slug_unique" UNIQUE("slug") ); --> statement-breakpoint CREATE TABLE "vendors" ( "id" text PRIMARY KEY NOT NULL, "slug" text NOT NULL, "name" text NOT NULL, "support_url" text, "support_phone" text, "notes" text, "sort_order" integer DEFAULT 0 NOT NULL, "active" boolean DEFAULT true NOT NULL, "created_at" timestamp with time zone DEFAULT now() NOT NULL, "updated_at" timestamp with time zone, CONSTRAINT "vendors_slug_unique" UNIQUE("slug") ); --> statement-breakpoint ALTER TABLE "functions" ADD CONSTRAINT "functions_category_id_skill_categories_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."skill_categories"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint ALTER TABLE "technologies" ADD CONSTRAINT "technologies_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint ALTER TABLE "technologies" ADD CONSTRAINT "technologies_category_id_skill_categories_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."skill_categories"("id") ON DELETE restrict ON UPDATE no action;--> statement-breakpoint CREATE INDEX "functions_slug_idx" ON "functions" USING btree ("slug");--> statement-breakpoint CREATE INDEX "functions_active_idx" ON "functions" USING btree ("active");--> statement-breakpoint CREATE INDEX "functions_category_idx" ON "functions" USING btree ("category_id");--> statement-breakpoint CREATE INDEX "skill_categories_slug_idx" ON "skill_categories" USING btree ("slug");--> statement-breakpoint CREATE INDEX "skill_categories_active_idx" ON "skill_categories" USING btree ("active");--> statement-breakpoint CREATE INDEX "technologies_slug_idx" ON "technologies" USING btree ("slug");--> statement-breakpoint CREATE INDEX "technologies_active_idx" ON "technologies" USING btree ("active");--> statement-breakpoint CREATE INDEX "technologies_vendor_idx" ON "technologies" USING btree ("vendor_id");--> statement-breakpoint CREATE INDEX "technologies_category_idx" ON "technologies" USING btree ("category_id");--> statement-breakpoint CREATE INDEX "vendors_slug_idx" ON "vendors" USING btree ("slug");--> statement-breakpoint CREATE INDEX "vendors_active_idx" ON "vendors" USING btree ("active");