ALTER TABLE "company_settings" ADD COLUMN "gps_interval_seconds" integer DEFAULT 5 NOT NULL; --> statement-breakpoint ALTER TABLE "company_settings" ADD COLUMN "checkout_warning_radius_meters" integer DEFAULT 200 NOT NULL; --> statement-breakpoint CREATE TABLE "timeline_footprints" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "employee_id" uuid NOT NULL, "latitude" double precision NOT NULL, "longitude" double precision NOT NULL, "recorded_at" bigint NOT NULL ); --> statement-breakpoint CREATE TABLE "timeline_activities" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "employee_id" uuid NOT NULL, "customer_id" uuid, "visit_id" uuid, "type" text NOT NULL, "source_type" text NOT NULL, "source_id" uuid NOT NULL, "latitude" double precision NOT NULL, "longitude" double precision NOT NULL, "recorded_at" bigint NOT NULL ); --> statement-breakpoint ALTER TABLE "timeline_footprints" ADD CONSTRAINT "timeline_footprints_employee_id_employees_id_fk" FOREIGN KEY ("employee_id") REFERENCES "public"."employees"("id") ON DELETE restrict ON UPDATE no action; --> statement-breakpoint ALTER TABLE "timeline_activities" ADD CONSTRAINT "timeline_activities_employee_id_employees_id_fk" FOREIGN KEY ("employee_id") REFERENCES "public"."employees"("id") ON DELETE restrict ON UPDATE no action; --> statement-breakpoint ALTER TABLE "timeline_activities" ADD CONSTRAINT "timeline_activities_customer_id_customers_id_fk" FOREIGN KEY ("customer_id") REFERENCES "public"."customers"("id") ON DELETE set null ON UPDATE no action; --> statement-breakpoint ALTER TABLE "timeline_activities" ADD CONSTRAINT "timeline_activities_visit_id_visits_id_fk" FOREIGN KEY ("visit_id") REFERENCES "public"."visits"("id") ON DELETE set null ON UPDATE no action; --> statement-breakpoint CREATE INDEX "timeline_footprints_employee_recorded_idx" ON "timeline_footprints" USING btree ("employee_id","recorded_at"); --> statement-breakpoint CREATE INDEX "timeline_activities_employee_recorded_idx" ON "timeline_activities" USING btree ("employee_id","recorded_at"); --> statement-breakpoint CREATE INDEX "timeline_activities_visit_id_idx" ON "timeline_activities" USING btree ("visit_id"); --> statement-breakpoint INSERT INTO "privilege_keys" ("code", "label", "sort_order") VALUES ('ADMIN.SALES.ACTIVITIES.TIMELINE', 'Sales timeline', 119), ('MOBILE.SALES.TIMELINE', 'Sales timeline (mobile)', 210);