@adaptware/eagles-db 0.5.11 → 0.5.14

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.
Files changed (47) hide show
  1. package/client/edge.js +16 -7
  2. package/client/index-browser.js +9 -1
  3. package/client/index.d.ts +283 -3
  4. package/client/index.js +16 -7
  5. package/client/package.json +1 -1
  6. package/client/schema.prisma +10 -2
  7. package/client/wasm.js +16 -7
  8. package/package.json +1 -1
  9. package/prisma/schema/applications.prisma +26 -19
  10. package/prisma/schema/competencyDictionary.prisma +38 -0
  11. package/prisma/schema/fitCheck.prisma +24 -42
  12. package/prisma/schema/interview.prisma +2 -0
  13. package/prisma/schema/jobDescription.prisma +1 -0
  14. package/prisma/schema/migrations/20260522120000_ongoing_evaluation_record_kind/migration.sql +25 -0
  15. package/prisma/schema/migrations/20260523120000_replace_record_kind_with_is_committed/migration.sql +24 -0
  16. package/prisma/schema/migrations/20260528120000_drop_job_description_recommendation_config/migration.sql +2 -0
  17. package/prisma/schema/migrations/20260710120000_add_resume_rendered_export_fields/migration.sql +9 -0
  18. package/prisma/schema/migrations/20260714120000_add_job_description_display_html_document/migration.sql +8 -0
  19. package/prisma/schema/migrations/20260716120000_add_offer_letters/migration.sql +183 -0
  20. package/prisma/schema/migrations/20260716140000_offer_schema_refinements/migration.sql +13 -0
  21. package/prisma/schema/migrations/20260716160000_offer_schema_hardening/migration.sql +95 -0
  22. package/prisma/schema/migrations/20260716180000_offer_letter_template_config/migration.sql +2 -0
  23. package/prisma/schema/migrations/20260716190000_add_evaluation_focus_areas/migration.sql +6 -0
  24. package/prisma/schema/migrations/20260717120000_offer_workflow_approval/migration.sql +30 -0
  25. package/prisma/schema/migrations/20260720120000_offer_letter_template_is_draft/migration.sql +5 -0
  26. package/prisma/schema/migrations/20260720140000_offer_status_split/migration.sql +51 -0
  27. package/prisma/schema/migrations/20260720140001_offer_status_split_backfill/migration.sql +37 -0
  28. package/prisma/schema/migrations/20260722120000_offer_draft_edited_html/migration.sql +13 -0
  29. package/prisma/schema/migrations/20260723150000_offer_withdraw_actor_no_show_reason/migration.sql +10 -0
  30. package/prisma/schema/migrations/20260724120000_open_job_offer_accepted_declined_counts/migration.sql +7 -0
  31. package/prisma/schema/ongoingEvaluation.prisma +2 -0
  32. package/prisma/schema/organisation.prisma +1 -0
  33. package/prisma/schema/pipelineDistributionAnalytics.prisma +8 -0
  34. package/client/libquery_engine-darwin.dylib.node +0 -0
  35. package/prisma/.DS_Store +0 -0
  36. package/prisma/migrations/20260519120000_migrate_shortlisted_to_selected/migration.sql +0 -2
  37. package/prisma/schema/.DS_Store +0 -0
  38. package/prisma/schema/migrations/20260519120000_add_analytics_schema/migration.sql +0 -84
  39. package/prisma/schema/migrations/20260625120000_add_interviewer_analytics/migration.sql +0 -26
  40. package/prisma/schema/migrations/20260629120000_add_user_lifecycle_activity_events/migration.sql +0 -13
  41. package/prisma/schema/migrations/20260629140000_drop_organisation_org_code/migration.sql +0 -2
  42. package/prisma/schema/migrations/20260629160000_employee_codes_dual_interviewer_analytics/migration.sql +0 -87
  43. package/prisma/schema/migrations/20260630120000_add_application_sources/migration.sql +0 -38
  44. package/prisma/schema/migrations/20260701120000_add_source_effectiveness_analytics/migration.sql +0 -40
  45. package/prisma/schema/migrations/20260702120000_add_analytics_daily_tables/migration.sql +0 -232
  46. package/prisma/schema/migrations/20260716120000_evaluation_category_four_values/migration.sql +0 -204
  47. package/prisma/schema/migrations/20260716130000_application_withdrawn_analytics/migration.sql +0 -31
@@ -0,0 +1,51 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "OfferStatus" AS ENUM ('OPEN', 'ACCEPTED', 'DECLINED', 'EXPIRED', 'WITHDRAWN', 'JOINED', 'NO_SHOW');
3
+
4
+ -- AlterEnum: ApplicationStatus — offer pipeline stages
5
+ -- Must be committed before OFFER/HIRED are used in UPDATE (see next migration).
6
+ ALTER TYPE "ApplicationStatus" ADD VALUE 'OFFER';
7
+ ALTER TYPE "ApplicationStatus" ADD VALUE 'HIRED';
8
+
9
+ -- AlterTable: Offer — status + no-show
10
+ ALTER TABLE "Offer" ADD COLUMN "status" "OfferStatus" NOT NULL DEFAULT 'OPEN',
11
+ ADD COLUMN "no_show_at" TIMESTAMP(3);
12
+
13
+ -- Backfill Offer.status from legacy substatus outcomes
14
+ UPDATE "Offer"
15
+ SET "status" = CASE
16
+ WHEN "substatus" IN (
17
+ 'OFFER_CREATED',
18
+ 'PENDING_APPROVAL',
19
+ 'OFFER_SENT',
20
+ 'VIEWED',
21
+ 'CHANGE_REQUESTED',
22
+ 'CHANGE_UNDER_REVIEW',
23
+ 'COUNTER_OFFER_SENT'
24
+ ) THEN 'OPEN'::"OfferStatus"
25
+ WHEN "substatus" = 'ACCEPTED' THEN 'ACCEPTED'::"OfferStatus"
26
+ WHEN "substatus" = 'DECLINED' THEN 'DECLINED'::"OfferStatus"
27
+ WHEN "substatus" = 'EXPIRED' THEN 'EXPIRED'::"OfferStatus"
28
+ WHEN "substatus" = 'WITHDRAWN' THEN 'WITHDRAWN'::"OfferStatus"
29
+ WHEN "substatus" = 'JOINED' THEN 'JOINED'::"OfferStatus"
30
+ ELSE 'OPEN'::"OfferStatus"
31
+ END;
32
+
33
+ -- Clear substatus for terminal outcomes
34
+ UPDATE "Offer"
35
+ SET "substatus" = NULL
36
+ WHERE "status" IN ('ACCEPTED', 'DECLINED', 'EXPIRED', 'WITHDRAWN', 'JOINED');
37
+
38
+ ALTER TABLE "Offer" ALTER COLUMN "substatus" DROP DEFAULT;
39
+ ALTER TABLE "Offer" ALTER COLUMN "substatus" DROP NOT NULL;
40
+
41
+ -- AlterTable: Application — offer_status mirror
42
+ ALTER TABLE "Application" ADD COLUMN "offer_status" "OfferStatus";
43
+
44
+ -- Backfill Application offer mirrors from active offers
45
+ UPDATE "Application" a
46
+ SET
47
+ "offer_status" = o."status",
48
+ "offer_substatus" = o."substatus"
49
+ FROM "Offer" o
50
+ WHERE o."application_id" = a."id"
51
+ AND o."is_active" = true;
@@ -0,0 +1,37 @@
1
+ -- ApplicationStatus OFFER/HIRED were added in the prior migration; safe to use after commit.
2
+
3
+ -- Backfill Application pipeline stage
4
+ UPDATE "Application"
5
+ SET "status" = 'HIRED'::"ApplicationStatus"
6
+ WHERE "offer_status" = 'JOINED'::"OfferStatus";
7
+
8
+ UPDATE "Application"
9
+ SET "status" = 'OFFER'::"ApplicationStatus"
10
+ WHERE "offer_status" IS NOT NULL
11
+ AND "offer_status" <> 'JOINED'::"OfferStatus";
12
+
13
+ -- Slim OfferSubstatus: remove terminal values
14
+ CREATE TYPE "OfferSubstatus_new" AS ENUM (
15
+ 'OFFER_CREATED',
16
+ 'PENDING_APPROVAL',
17
+ 'OFFER_SENT',
18
+ 'VIEWED',
19
+ 'CHANGE_REQUESTED',
20
+ 'CHANGE_UNDER_REVIEW',
21
+ 'COUNTER_OFFER_SENT'
22
+ );
23
+
24
+ ALTER TABLE "Offer"
25
+ ALTER COLUMN "substatus" TYPE "OfferSubstatus_new"
26
+ USING ("substatus"::text::"OfferSubstatus_new");
27
+
28
+ ALTER TABLE "Application"
29
+ ALTER COLUMN "offer_substatus" TYPE "OfferSubstatus_new"
30
+ USING ("offer_substatus"::text::"OfferSubstatus_new");
31
+
32
+ DROP TYPE "OfferSubstatus";
33
+ ALTER TYPE "OfferSubstatus_new" RENAME TO "OfferSubstatus";
34
+
35
+ -- CreateIndex
36
+ CREATE INDEX "Offer_organisation_id_status_idx" ON "Offer"("organisation_id", "status");
37
+ CREATE INDEX "Offer_status_idx" ON "Offer"("status");
@@ -0,0 +1,13 @@
1
+ -- Offer-scoped draft letter HTML (never mutates OfferLetterTemplate).
2
+ ALTER TABLE "public"."Offer"
3
+ ADD COLUMN "draft_edited_html_document_id" TEXT;
4
+
5
+ CREATE INDEX "Offer_draft_edited_html_document_id_idx"
6
+ ON "public"."Offer"("draft_edited_html_document_id");
7
+
8
+ ALTER TABLE "public"."Offer"
9
+ ADD CONSTRAINT "Offer_draft_edited_html_document_id_fkey"
10
+ FOREIGN KEY ("draft_edited_html_document_id")
11
+ REFERENCES "public"."Document"("id")
12
+ ON DELETE SET NULL
13
+ ON UPDATE CASCADE;
@@ -0,0 +1,10 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "public"."OfferWithdrawActor" AS ENUM ('CANDIDATE', 'ORGANISATION');
3
+
4
+ -- CreateEnum
5
+ CREATE TYPE "public"."OfferNoShowReason" AS ENUM ('ACCEPTED_ELSEWHERE', 'OTHER');
6
+
7
+ -- AlterTable
8
+ ALTER TABLE "public"."Offer"
9
+ ADD COLUMN "withdraw_actor" "public"."OfferWithdrawActor",
10
+ ADD COLUMN "no_show_reason" "public"."OfferNoShowReason";
@@ -0,0 +1,7 @@
1
+ ALTER TABLE analytics.open_job_analytics
2
+ ADD COLUMN IF NOT EXISTS offer_accepted_count INT NOT NULL DEFAULT 0,
3
+ ADD COLUMN IF NOT EXISTS offer_declined_count INT NOT NULL DEFAULT 0;
4
+
5
+ ALTER TABLE analytics.open_job_analytics_daily
6
+ ADD COLUMN IF NOT EXISTS offer_accepted_count INT NOT NULL DEFAULT 0,
7
+ ADD COLUMN IF NOT EXISTS offer_declined_count INT NOT NULL DEFAULT 0;
@@ -77,5 +77,7 @@ model OngoingEvaluation {
77
77
  @@unique([application_id, evaluation_plan_id])
78
78
  @@index([application_id])
79
79
  @@index([evaluation_plan_id])
80
+ @@index([application_id, is_active, state])
81
+ @@index([job_description_id, state, round_status])
80
82
  @@schema("public")
81
83
  }
@@ -66,6 +66,7 @@ model Organisation {
66
66
  departments Department[]
67
67
  hiring_plans HiringPlan[]
68
68
  employees Employee[]
69
+ competency_dictionaries CompetencyDictionary[]
69
70
 
70
71
  @@index([name])
71
72
  @@schema("public")
@@ -18,6 +18,10 @@ model PipelineDistributionAnalytics {
18
18
  behavioral_round_count Int @default(0)
19
19
 
20
20
  shortlisted_count Int @default(0)
21
+ offered_count Int @default(0)
22
+ offer_accepted_count Int @default(0)
23
+ offer_declined_count Int @default(0)
24
+ withdrawn_count Int @default(0)
21
25
 
22
26
  updated_at DateTime @updatedAt
23
27
 
@@ -50,6 +54,10 @@ model PipelineDistributionAnalyticsDaily {
50
54
  behavioral_round_count Int @default(0)
51
55
 
52
56
  shortlisted_count Int @default(0)
57
+ offered_count Int @default(0)
58
+ offer_accepted_count Int @default(0)
59
+ offer_declined_count Int @default(0)
60
+ withdrawn_count Int @default(0)
53
61
 
54
62
  @@unique([snapshot_date, job_description_id])
55
63
  @@index([snapshot_date], map: "pdad_snapshot_date_idx")
package/prisma/.DS_Store DELETED
Binary file
@@ -1,2 +0,0 @@
1
- -- Migrate legacy terminal-positive status to SELECTED (SHORTLISTED enum value retained but unused).
2
- UPDATE applications SET status = 'SELECTED' WHERE status = 'SHORTLISTED';
Binary file
@@ -1,84 +0,0 @@
1
- -- CreateSchema
2
- CREATE SCHEMA IF NOT EXISTS "analytics";
3
-
4
- -- CreateEnum
5
- CREATE TYPE "analytics"."RoundResult" AS ENUM ('PASSED', 'FAILED');
6
-
7
- -- CreateTable
8
- CREATE TABLE "analytics"."round_analytics" (
9
- "id" TEXT NOT NULL,
10
- "organisation_id" TEXT NOT NULL,
11
- "application_id" TEXT NOT NULL,
12
- "candidate_id" TEXT NOT NULL,
13
- "job_description_id" TEXT NOT NULL,
14
- "evaluation_plan_id" TEXT NOT NULL,
15
- "round_id" TEXT NOT NULL,
16
- "round_name" TEXT,
17
- "evaluation_category" "EvaluationCategory",
18
- "round_type" "RoundType",
19
- "assigned_at" TIMESTAMP(3),
20
- "interview_created_at" TIMESTAMP(3),
21
- "interview_scheduled_at" TIMESTAMP(3),
22
- "interview_started_at" TIMESTAMP(3),
23
- "interview_completed_at" TIMESTAMP(3),
24
- "interview_evaluated_at" TIMESTAMP(3),
25
- "round_completed_at" TIMESTAMP(3),
26
- "round_result" "analytics"."RoundResult",
27
- "round_result_at" TIMESTAMP(3),
28
- "scheduling_duration_minutes" INTEGER,
29
- "interview_duration_minutes" INTEGER,
30
- "feedback_duration_minutes" INTEGER,
31
- "decision_duration_minutes" INTEGER,
32
- "total_round_duration_minutes" INTEGER,
33
- "is_custom" BOOLEAN NOT NULL DEFAULT false,
34
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
35
- "updated_at" TIMESTAMP(3) NOT NULL,
36
-
37
- CONSTRAINT "round_analytics_pkey" PRIMARY KEY ("id")
38
- );
39
-
40
- -- CreateTable
41
- CREATE TABLE "analytics"."job_round_analytics" (
42
- "id" TEXT NOT NULL,
43
- "organisation_id" TEXT NOT NULL,
44
- "job_description_id" TEXT NOT NULL,
45
- "evaluation_plan_id" TEXT NOT NULL,
46
- "round_name" TEXT NOT NULL,
47
- "evaluation_category" "EvaluationCategory",
48
- "is_custom" BOOLEAN NOT NULL DEFAULT false,
49
- "assigned_count" INTEGER NOT NULL DEFAULT 0,
50
- "completed_count" INTEGER NOT NULL DEFAULT 0,
51
- "passed_count" INTEGER NOT NULL DEFAULT 0,
52
- "failed_count" INTEGER NOT NULL DEFAULT 0,
53
- "withdrawn_count" INTEGER NOT NULL DEFAULT 0,
54
- "no_show_count" INTEGER NOT NULL DEFAULT 0,
55
- "total_completion_minutes" BIGINT NOT NULL DEFAULT 0,
56
- "avg_completion_minutes" DOUBLE PRECISION,
57
- "updated_at" TIMESTAMP(3) NOT NULL,
58
-
59
- CONSTRAINT "job_round_analytics_pkey" PRIMARY KEY ("id")
60
- );
61
-
62
- -- CreateIndex
63
- CREATE UNIQUE INDEX "round_analytics_round_id_key" ON "analytics"."round_analytics"("round_id");
64
-
65
- -- CreateIndex
66
- CREATE INDEX "round_analytics_organisation_id_idx" ON "analytics"."round_analytics"("organisation_id");
67
-
68
- -- CreateIndex
69
- CREATE INDEX "round_analytics_job_description_id_idx" ON "analytics"."round_analytics"("job_description_id");
70
-
71
- -- CreateIndex
72
- CREATE INDEX "round_analytics_application_id_idx" ON "analytics"."round_analytics"("application_id");
73
-
74
- -- CreateIndex
75
- CREATE INDEX "round_analytics_candidate_id_idx" ON "analytics"."round_analytics"("candidate_id");
76
-
77
- -- CreateIndex
78
- CREATE INDEX "round_analytics_evaluation_category_idx" ON "analytics"."round_analytics"("evaluation_category");
79
-
80
- -- CreateIndex
81
- CREATE INDEX "round_analytics_round_result_idx" ON "analytics"."round_analytics"("round_result");
82
-
83
- -- CreateIndex
84
- CREATE UNIQUE INDEX "job_round_analytics_job_description_id_evaluation_plan_id_key" ON "analytics"."job_round_analytics"("job_description_id", "evaluation_plan_id");
@@ -1,26 +0,0 @@
1
- -- CreateTable
2
- CREATE TABLE "analytics"."interviewer_analytics" (
3
- "id" TEXT NOT NULL,
4
- "organisation_id" TEXT NOT NULL,
5
- "user_id" TEXT NOT NULL,
6
- "name" TEXT,
7
- "employee_id" TEXT,
8
- "interview_count" INTEGER NOT NULL DEFAULT 0,
9
- "accepted_count" INTEGER NOT NULL DEFAULT 0,
10
- "rejected_count" INTEGER NOT NULL DEFAULT 0,
11
- "unsure_count" INTEGER NOT NULL DEFAULT 0,
12
- "ai_disagreement_count" INTEGER NOT NULL DEFAULT 0,
13
- "ai_disagreement_percent" DOUBLE PRECISION,
14
- "avg_difficulty" DOUBLE PRECISION,
15
- "avg_supportiveness" DOUBLE PRECISION,
16
- "avg_topics_coverage_percent" DOUBLE PRECISION,
17
- "updated_at" TIMESTAMP(3) NOT NULL,
18
-
19
- CONSTRAINT "interviewer_analytics_pkey" PRIMARY KEY ("id")
20
- );
21
-
22
- -- CreateIndex
23
- CREATE UNIQUE INDEX "interviewer_analytics_organisation_id_user_id_key" ON "analytics"."interviewer_analytics"("organisation_id", "user_id");
24
-
25
- -- CreateIndex
26
- CREATE INDEX "interviewer_analytics_organisation_id_idx" ON "analytics"."interviewer_analytics"("organisation_id");
@@ -1,13 +0,0 @@
1
- -- AlterEnum
2
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_INVITED';
3
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_INVITATION_RESENT';
4
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_CREATED';
5
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_INVITATION_ACCEPTED';
6
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_INVITATION_EXPIRED';
7
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_DEACTIVATED';
8
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_REACTIVATED';
9
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_ROLE_CHANGED';
10
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'USER_PROFILE_COMPLETED';
11
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'CANDIDATE_REGISTERED';
12
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'CANDIDATE_CREATED';
13
- ALTER TYPE "public"."ActivityEventType" ADD VALUE 'CANDIDATE_PROFILE_COMPLETED';
@@ -1,2 +0,0 @@
1
- ALTER TABLE "Organisation" DROP COLUMN IF EXISTS "org_code";
2
- ALTER TABLE "Organisation" ADD COLUMN IF NOT EXISTS "employee_sequence" INTEGER NOT NULL DEFAULT 1;
@@ -1,87 +0,0 @@
1
- ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "employee_number" INTEGER;
2
- ALTER TABLE "User" ADD COLUMN IF NOT EXISTS "employee_code" TEXT;
3
-
4
- CREATE UNIQUE INDEX IF NOT EXISTS "User_employee_code_key" ON "User"("employee_code");
5
- CREATE INDEX IF NOT EXISTS "User_organisation_id_employee_number_idx" ON "User"("organisation_id", "employee_number");
6
-
7
- DROP TABLE IF EXISTS "analytics"."interviewer_analytics";
8
-
9
- CREATE TABLE "analytics"."interviewer_organisation_analytics" (
10
- "id" TEXT NOT NULL,
11
- "organisation_id" TEXT NOT NULL,
12
- "user_id" TEXT NOT NULL,
13
- "name" TEXT,
14
- "employee_id" TEXT,
15
- "interview_count" INTEGER NOT NULL DEFAULT 0,
16
- "accepted_count" INTEGER NOT NULL DEFAULT 0,
17
- "rejected_count" INTEGER NOT NULL DEFAULT 0,
18
- "unsure_count" INTEGER NOT NULL DEFAULT 0,
19
- "ai_disagreement_count" INTEGER NOT NULL DEFAULT 0,
20
- "ai_disagreement_percent" DOUBLE PRECISION,
21
- "avg_difficulty" DOUBLE PRECISION,
22
- "avg_supportiveness" DOUBLE PRECISION,
23
- "avg_topics_coverage_percent" DOUBLE PRECISION,
24
- "updated_at" TIMESTAMP(3) NOT NULL,
25
-
26
- CONSTRAINT "interviewer_organisation_analytics_pkey" PRIMARY KEY ("id")
27
- );
28
-
29
- CREATE UNIQUE INDEX "interviewer_organisation_analytics_organisation_id_user_id_key"
30
- ON "analytics"."interviewer_organisation_analytics"("organisation_id", "user_id");
31
- CREATE INDEX "interviewer_organisation_analytics_organisation_id_idx"
32
- ON "analytics"."interviewer_organisation_analytics"("organisation_id");
33
- CREATE INDEX "interviewer_organisation_analytics_organisation_id_user_id_idx"
34
- ON "analytics"."interviewer_organisation_analytics"("organisation_id", "user_id");
35
-
36
- CREATE TABLE "analytics"."interviewer_job_analytics" (
37
- "id" TEXT NOT NULL,
38
- "organisation_id" TEXT NOT NULL,
39
- "user_id" TEXT NOT NULL,
40
- "job_description_id" TEXT NOT NULL,
41
- "hiring_manager_id" TEXT,
42
- "department" TEXT,
43
- "location" TEXT,
44
- "role_title" TEXT,
45
- "job_code" TEXT,
46
- "opened_at" TIMESTAMP(3),
47
- "name" TEXT,
48
- "employee_id" TEXT,
49
- "interview_count" INTEGER NOT NULL DEFAULT 0,
50
- "accepted_count" INTEGER NOT NULL DEFAULT 0,
51
- "rejected_count" INTEGER NOT NULL DEFAULT 0,
52
- "unsure_count" INTEGER NOT NULL DEFAULT 0,
53
- "ai_disagreement_count" INTEGER NOT NULL DEFAULT 0,
54
- "ai_disagreement_percent" DOUBLE PRECISION,
55
- "avg_difficulty" DOUBLE PRECISION,
56
- "avg_supportiveness" DOUBLE PRECISION,
57
- "avg_topics_coverage_percent" DOUBLE PRECISION,
58
- "updated_at" TIMESTAMP(3) NOT NULL,
59
-
60
- CONSTRAINT "interviewer_job_analytics_pkey" PRIMARY KEY ("id")
61
- );
62
-
63
- CREATE UNIQUE INDEX "interviewer_job_analytics_organisation_id_user_id_job_descri_key"
64
- ON "analytics"."interviewer_job_analytics"("organisation_id", "user_id", "job_description_id");
65
- CREATE INDEX "interviewer_job_analytics_organisation_id_job_description_id_idx"
66
- ON "analytics"."interviewer_job_analytics"("organisation_id", "job_description_id");
67
- CREATE INDEX "interviewer_job_analytics_organisation_id_hiring_manager_id_idx"
68
- ON "analytics"."interviewer_job_analytics"("organisation_id", "hiring_manager_id");
69
- CREATE INDEX "interviewer_job_analytics_organisation_id_department_idx"
70
- ON "analytics"."interviewer_job_analytics"("organisation_id", "department");
71
- CREATE INDEX "interviewer_job_analytics_organisation_id_location_idx"
72
- ON "analytics"."interviewer_job_analytics"("organisation_id", "location");
73
- CREATE INDEX "interviewer_job_analytics_organisation_id_user_id_idx"
74
- ON "analytics"."interviewer_job_analytics"("organisation_id", "user_id");
75
-
76
- CREATE INDEX IF NOT EXISTS "job_round_analytics_organisation_id_idx"
77
- ON "analytics"."job_round_analytics"("organisation_id");
78
- CREATE INDEX IF NOT EXISTS "job_round_analytics_organisation_id_hiring_manager_id_idx"
79
- ON "analytics"."job_round_analytics"("organisation_id", "hiring_manager_id");
80
- CREATE INDEX IF NOT EXISTS "job_round_analytics_job_description_id_idx"
81
- ON "analytics"."job_round_analytics"("job_description_id");
82
-
83
- CREATE INDEX IF NOT EXISTS "pipeline_distribution_analytics_job_description_id_idx"
84
- ON "analytics"."pipeline_distribution_analytics"("job_description_id");
85
-
86
- CREATE INDEX IF NOT EXISTS "open_job_analytics_job_description_id_idx"
87
- ON "analytics"."open_job_analytics"("job_description_id");
@@ -1,38 +0,0 @@
1
- -- CreateEnum
2
- CREATE TYPE "public"."SourceCategory" AS ENUM ('JOB_BOARD', 'REFERRAL', 'AGENCY', 'SOCIAL_MEDIA', 'CAREERS_PAGE', 'EVENT', 'OTHER');
3
-
4
- -- CreateTable
5
- CREATE TABLE "public"."Source" (
6
- "id" TEXT NOT NULL,
7
- "organisation_id" TEXT NOT NULL,
8
- "name" TEXT NOT NULL,
9
- "category" "public"."SourceCategory",
10
- "parent_source_id" TEXT,
11
- "colour" TEXT,
12
- "description" TEXT,
13
- "is_active" BOOLEAN NOT NULL DEFAULT true,
14
- "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
15
- "updated_at" TIMESTAMP(3) NOT NULL,
16
-
17
- CONSTRAINT "Source_pkey" PRIMARY KEY ("id")
18
- );
19
-
20
- -- CreateIndex
21
- CREATE UNIQUE INDEX "Source_organisation_id_name_key" ON "public"."Source"("organisation_id", "name");
22
- CREATE INDEX "Source_organisation_id_idx" ON "public"."Source"("organisation_id");
23
- CREATE INDEX "Source_organisation_id_category_idx" ON "public"."Source"("organisation_id", "category");
24
- CREATE INDEX "Source_organisation_id_is_active_idx" ON "public"."Source"("organisation_id", "is_active");
25
- CREATE INDEX "Source_parent_source_id_idx" ON "public"."Source"("parent_source_id");
26
-
27
- -- AddForeignKey
28
- ALTER TABLE "public"."Source" ADD CONSTRAINT "Source_organisation_id_fkey" FOREIGN KEY ("organisation_id") REFERENCES "public"."Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
29
- ALTER TABLE "public"."Source" ADD CONSTRAINT "Source_parent_source_id_fkey" FOREIGN KEY ("parent_source_id") REFERENCES "public"."Source"("id") ON DELETE SET NULL ON UPDATE CASCADE;
30
-
31
- -- AlterTable
32
- ALTER TABLE "public"."Application" ADD COLUMN "source_id" TEXT;
33
-
34
- -- CreateIndex
35
- CREATE INDEX "Application_source_id_idx" ON "public"."Application"("source_id");
36
-
37
- -- AddForeignKey
38
- ALTER TABLE "public"."Application" ADD CONSTRAINT "Application_source_id_fkey" FOREIGN KEY ("source_id") REFERENCES "public"."Source"("id") ON DELETE SET NULL ON UPDATE CASCADE;
@@ -1,40 +0,0 @@
1
- CREATE TABLE "analytics"."source_effectiveness_analytics" (
2
- "id" TEXT NOT NULL,
3
- "organisation_id" TEXT NOT NULL,
4
- "job_description_id" TEXT NOT NULL,
5
- "source_id" TEXT NOT NULL,
6
- "source_name" TEXT NOT NULL,
7
- "source_category" "public"."SourceCategory",
8
- "source_colour" TEXT,
9
- "job_code" TEXT,
10
- "job_number" INTEGER,
11
- "role_title" TEXT,
12
- "hiring_manager_id" TEXT,
13
- "applications_count" INTEGER NOT NULL DEFAULT 0,
14
- "screened_count" INTEGER NOT NULL DEFAULT 0,
15
- "evaluated_count" INTEGER NOT NULL DEFAULT 0,
16
- "rejected_count" INTEGER NOT NULL DEFAULT 0,
17
- "shortlisted_count" INTEGER NOT NULL DEFAULT 0,
18
- "offered_count" INTEGER NOT NULL DEFAULT 0,
19
- "offer_accepted_count" INTEGER NOT NULL DEFAULT 0,
20
- "offer_declined_count" INTEGER NOT NULL DEFAULT 0,
21
- "withdrawn_count" INTEGER NOT NULL DEFAULT 0,
22
- "hired_count" INTEGER NOT NULL DEFAULT 0,
23
- "total_fit_score" DOUBLE PRECISION NOT NULL DEFAULT 0,
24
- "fit_score_sample_count" INTEGER NOT NULL DEFAULT 0,
25
- "average_fit_score" DOUBLE PRECISION,
26
- "updated_at" TIMESTAMP(3) NOT NULL,
27
-
28
- CONSTRAINT "source_effectiveness_analytics_pkey" PRIMARY KEY ("id")
29
- );
30
-
31
- CREATE UNIQUE INDEX "source_effectiveness_analytics_organisation_id_job_descripti_key"
32
- ON "analytics"."source_effectiveness_analytics"("organisation_id", "job_description_id", "source_id");
33
- CREATE INDEX "source_effectiveness_analytics_organisation_id_idx"
34
- ON "analytics"."source_effectiveness_analytics"("organisation_id");
35
- CREATE INDEX "source_effectiveness_analytics_organisation_id_source_id_idx"
36
- ON "analytics"."source_effectiveness_analytics"("organisation_id", "source_id");
37
- CREATE INDEX "source_effectiveness_analytics_organisation_id_hiring_manag_idx"
38
- ON "analytics"."source_effectiveness_analytics"("organisation_id", "hiring_manager_id");
39
- CREATE INDEX "source_effectiveness_analytics_job_description_id_idx"
40
- ON "analytics"."source_effectiveness_analytics"("job_description_id");