@taodigital/database 0.0.0-stage → 1.2.1
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.
- package/README.md +21 -2
- package/dist/index.d.ts +58 -0
- package/dist/index.js +209 -0
- package/package.json +29 -4
- package/prisma/migrations/0000_init/migration.sql +220 -0
- package/prisma/migrations/0001_tenant_isolation/migration.sql +43 -0
- package/prisma/migrations/0002_app_runtime_role/migration.sql +14 -0
- package/prisma/migrations/0003_skill_taxonomy/migration.sql +30 -0
- package/prisma/migrations/0004_extended_models/migration.sql +215 -0
- package/prisma/migrations/0005_enhanced_test_artifacts/migration.sql +24 -0
- package/prisma/migrations/0006_tenant_settings/migration.sql +28 -0
- package/prisma/migrations/0007_project_slug/migration.sql +11 -0
- package/prisma/migrations/0008_project_crawl_config/migration.sql +3 -0
- package/prisma/migrations/0009_tenant_slug/migration.sql +11 -0
- package/prisma/migrations/0010_user_password/migration.sql +3 -0
- package/prisma/migrations/0011_oauth_connections/migration.sql +78 -0
- package/prisma/migrations/0012_agent_webhooks/migration.sql +46 -0
- package/prisma/migrations/0013_project_artifacts/migration.sql +27 -0
- package/prisma/migrations/0014_knowledge_chunks/migration.sql +37 -0
- package/prisma/migrations/20260626022056_platform_job_migration/migration.sql +44 -0
- package/prisma/migrations/20260626053339_kag_schema_update/migration.sql +27 -0
- package/prisma/migrations/20260626053340_restore_bm25_index/migration.sql +13 -0
- package/prisma/migrations/20260626063704_token_optimisation/migration.sql +86 -0
- package/prisma/migrations/20260626080000_job_name/migration.sql +2 -0
- package/prisma/migrations/20260626090000_rls_missing_tables/migration.sql +39 -0
- package/prisma/migrations/20260626100000_token_budget/migration.sql +21 -0
- package/prisma/migrations/20260626110000_screen_groups/migration.sql +42 -0
- package/prisma/migrations/20260626120000_artifact_intelligence/migration.sql +5 -0
- package/prisma/migrations/20260626130000_notifications/migration.sql +34 -0
- package/prisma/migrations/20260627100000_element_viewport/migration.sql +2 -0
- package/prisma/migrations/20260627100000_screenshot_cloud_url/migration.sql +2 -0
- package/prisma/migrations/20260627110000_screenshot_index/migration.sql +2 -0
- package/prisma/migrations/20260627140000_artifact_storage_key/migration.sql +3 -0
- package/prisma/migrations/20260627150000_screen_lifecycle/migration.sql +5 -0
- package/prisma/migrations/20260627160000_native_app_support/migration.sql +41 -0
- package/prisma/migrations/20260627200000_rls_missing_tables/migration.sql +57 -0
- package/prisma/migrations/20260627210000_llmcalllog_tasktype/migration.sql +1 -0
- package/prisma/migrations/20260628100000_element_enrichment/migration.sql +7 -0
- package/prisma/migrations/20260628110000_element_hash/migration.sql +6 -0
- package/prisma/migrations/20260628120000_screen_diff/migration.sql +20 -0
- package/prisma/migrations/20260628130000_probe_observations/migration.sql +19 -0
- package/prisma/migrations/20260629100000_visual_baseline_masking/migration.sql +1 -0
- package/prisma/migrations/20260629110000_testcase_viewports/migration.sql +1 -0
- package/prisma/migrations/20260630100000_visual_baseline_element_snapshot/migration.sql +1 -0
- package/prisma/migrations/20260630110000_git_branched_baselines/migration.sql +11 -0
- package/prisma/migrations/20260630120000_testcase_viewport_constraint/migration.sql +1 -0
- package/prisma/migrations/20260630130000_test_case_runs/migration.sql +22 -0
- package/prisma/migrations/20260630140000_perf_env_comments/migration.sql +68 -0
- package/prisma/migrations/20260630150000_testcase_gen_at/migration.sql +2 -0
- package/prisma/migrations/20260630160000_rls_catchup_late_tables/migration.sql +41 -0
- package/prisma/migrations/20260701100000_skill_file_diff_approval/migration.sql +9 -0
- package/prisma/migrations/20260701200000_workspace_connector/migration.sql +20 -0
- package/prisma/migrations/20260701220000_screen_a11y_security/migration.sql +2 -0
- package/prisma/migrations/20260702100000_ci_threshold_root_cause/migration.sql +2 -0
- package/prisma/migrations/20260702120000_medium_priority_gaps/migration.sql +28 -0
- package/prisma/migrations/20260702140000_testcase_v2_technique/migration.sql +7 -0
- package/prisma/migrations/20260702150000_add_app_field/migration.sql +40 -0
- package/prisma/migrations/20260702160000_add_requirement_model/migration.sql +62 -0
- package/prisma/migrations/20260702180000_add_invitation_model/migration.sql +53 -0
- package/prisma/migrations/20260702190000_suite_hierarchy_artifact_trace/migration.sql +28 -0
- package/prisma/migrations/20260702200000_project_member_access/migration.sql +31 -0
- package/prisma/migrations/20260703000000_add_system_config/migration.sql +11 -0
- package/prisma/migrations/20260703000000_custom_roles/migration.sql +29 -0
- package/prisma/migrations/20260703100000_platform_admin/migration.sql +11 -0
- package/prisma/migrations/20260703110000_add_extension_models/migration.sql +106 -0
- package/prisma/migrations/20260703120000_project_restricted_column/migration.sql +1 -0
- package/prisma/migrations/20260703200000_system_config_category_index/migration.sql +1 -0
- package/prisma/migrations/20260703210000_workspace_layer/migration.sql +24 -0
- package/prisma/migrations/20260703230000_workspace_agent_tokens/migration.sql +2 -0
- package/prisma/migrations/20260704000000_requirement_rls_policy/migration.sql +35 -0
- package/prisma/migrations/20260704100000_fix_oauth_auditlog_cascade/migration.sql +9 -0
- package/prisma/migrations/20260704110000_skillfile_approval_status/migration.sql +2 -0
- package/prisma/migrations/20260704120000_scenario_suspect_workspace/migration.sql +35 -0
- package/prisma/migrations/20260704130000_testcase_traceto_suspect_indexes/migration.sql +5 -0
- package/prisma/migrations/20260704140000_workspace_rls/migration.sql +19 -0
- package/prisma/migrations/20260704150000_project_cascade_deletes/migration.sql +125 -0
- package/prisma/migrations/20260705100000_platform_job_worker_id/migration.sql +12 -0
- package/prisma/migrations/20260705110000_screen_discovery_method/migration.sql +7 -0
- package/prisma/migrations/20260705120000_webhook_delivery/migration.sql +32 -0
- package/prisma/migrations/20260705130000_tenant_feature_flags/migration.sql +23 -0
- package/prisma/migrations/20260705140000_auth_sessions/migration.sql +30 -0
- package/prisma/migrations/20260705150000_fix_rls_wrong_session_var/migration.sql +51 -0
- package/prisma/migrations/20260705160000_testcase_flaky_quarantine/migration.sql +14 -0
- package/prisma/migrations/20260705170000_testcaserun_browser/migration.sql +6 -0
- package/prisma/migrations/20260705180000_allow_custom_roles/migration.sql +22 -0
- package/prisma/migrations/20260706050000_screen_markdown_extraction/migration.sql +8 -0
- package/prisma/migrations/20260706090000_add_lighthouse_to_performance_snapshot/migration.sql +4 -0
- package/prisma/migrations/20260706100000_add_lighthouse_bp_and_job_index/migration.sql +5 -0
- package/prisma/migrations/20260706110000_add_visual_diff_ai_summary/migration.sql +2 -0
- package/prisma/migrations/20260707120000_script_bundles/migration.sql +25 -0
- package/prisma/migrations/20260707130000_requirement_source_section/migration.sql +4 -0
- package/prisma/migrations/20260707140000_structured_skill_metadata/migration.sql +8 -0
- package/prisma/migrations/20260707150000_crawler_platform_primitives/migration.sql +112 -0
- package/prisma/migrations/20260707160000_screen_group_versioning/migration.sql +9 -0
- package/prisma/migrations/20260707170000_add_mfa_fields/migration.sql +24 -0
- package/prisma/migrations/20260707180000_add_missing_tables/migration.sql +158 -0
- package/prisma/migrations/20260707190000_add_missing_columns/migration.sql +15 -0
- package/prisma/migrations/20260707200000_add_plan_sessions/migration.sql +1 -0
- package/prisma/migrations/20260708100000_missing_columns_comprehensive/migration.sql +15 -0
- package/prisma/migrations/20260708200000_testcase_dataset_column/migration.sql +16 -0
- package/prisma/migrations/20260709100000_add_filename_to_native_app_build/migration.sql +1 -0
- package/prisma/migrations/20260709200000_cloud_url_visual_artifacts/migration.sql +6 -0
- package/prisma/migrations/20260714200000_add_cached_scenarios_to_artifact/migration.sql +4 -0
- package/prisma/migrations/20260715200000_screen_markdown_content/migration.sql +2 -0
- package/prisma/migrations/20260716100000_github_repo_coverage_tables/migration.sql +114 -0
- package/prisma/migrations/20260716200000_github_pr_script_validation/migration.sql +48 -0
- package/prisma/migrations/20260716210000_s3_content_keys/migration.sql +20 -0
- package/prisma/migrations/20260717220000_ide_push_token/migration.sql +21 -0
- package/prisma/migrations/20260717230000_ide_push_script_ids/migration.sql +2 -0
- package/prisma/migrations/20260730040000_add_step_evidence_and_validation/migration.sql +93 -0
- package/prisma/migrations/20260803000000_add_tenantId_to_test_data_row/migration.sql +40 -0
- package/prisma/migrations/20260804000000_add_project_restricted/migration.sql +6 -0
- package/prisma/migrations/20260804000000_add_user_avatar_url/migration.sql +4 -0
- package/prisma/migrations/20260805000000_add_auditlog_ipaddress/migration.sql +2 -0
- package/prisma/migrations/20260807000000_add_test_data_classification/migration.sql +18 -0
- package/prisma/migrations/20260807000001_add_test_case_notes/migration.sql +5 -0
- package/prisma/migrations/20260807000002_add_visual_baseline_browser_structured_steps/migration.sql +11 -0
- package/prisma/migrations/20260807100000_add_tenant_plan_config/migration.sql +14 -0
- package/prisma/migrations/20260808000000_agent_token_missing_columns/migration.sql +22 -0
- package/prisma/migrations/20260808000001_visual_diff_image_and_threshold/migration.sql +8 -0
- package/prisma/migrations/20260808000002_ssoconfig_email_domains/migration.sql +7 -0
- package/prisma/migrations/20260808000003_project_status_description_updatedat/migration.sql +7 -0
- package/prisma/migrations/20260814000000_workspace_require_mfa/migration.sql +2 -0
- package/prisma/migrations/20260814000001_add_screenshot_dpr/migration.sql +2 -0
- package/prisma/migrations/20260818000000_add_content_hash_to_test_case/migration.sql +6 -0
- package/prisma/migrations/20260818000001_add_grounding_hash_to_test_case/migration.sql +3 -0
- package/prisma/migrations/20260819000000_coverage_mapping_cross_encoder_fields/migration.sql +3 -0
- package/prisma/migrations/20260820000000_add_locators_json_to_test_case/migration.sql +6 -0
- package/prisma/migrations/20260820000001_add_test_case_version/migration.sql +27 -0
- package/prisma/migrations/20260826000000_add_capture_step_screenshots/migration.sql +1 -0
- package/prisma/migrations/20260903000000_add_platform_job_dlq/migration.sql +10 -0
- package/prisma/migrations/20260903000002_add_versioning_tables/migration.sql +38 -0
- package/prisma/migrations/20260903000003_add_learning_models/migration.sql +71 -0
- package/prisma/migrations/20260903000004_add_workspace_agent_prompts/migration.sql +33 -0
- package/prisma/migrations/20260903000005_add_config_history/migration.sql +70 -0
- package/prisma/migrations/20260903000006_add_skill_file_config/migration.sql +24 -0
- package/prisma/migrations/20260904000000_add_agent_prompt_platform_table/migration.sql +23 -0
- package/prisma/migrations/20260904180424_rbac_role_configs_admin_roles/migration.sql +606 -0
- package/prisma/migrations/20260907000000_fix_testcase_timestamps/migration.sql +13 -0
- package/prisma/migrations/20260907000001_add_artifact_imported_suite_id/migration.sql +1 -0
- package/prisma/migrations/20260907000002_add_user_login_tracking/migration.sql +9 -0
- package/prisma/migrations/20260907000003_add_artifact_import_tracking/migration.sql +9 -0
- package/prisma/migrations/20260907000004_add_artifact_version_chain/migration.sql +18 -0
- package/prisma/migrations/20260908000000_add_project_vsa_enabled/migration.sql +2 -0
- package/prisma/migrations/20260908000001_rbac_migration_catchup/migration.sql +314 -0
- package/prisma/migrations/20260908000002_fix_role_configs_empty_permissions/migration.sql +22 -0
- package/prisma/migrations/20260908000003_sync_builtin_role_permissions/migration.sql +38 -0
- package/prisma/migrations/20260909000000_add_filepath_to_testscript/migration.sql +5 -0
- package/prisma/migrations/20260909000001_add_alignment_result_table/migration.sql +31 -0
- package/prisma/migrations/20260910000000_add_admin_mfa/migration.sql +35 -0
- package/prisma/migrations/20260910000000_add_dom_snapshot_cloud_url/migration.sql +2 -0
- package/prisma/migrations/20260910000001_add_requires_auth_to_screen/migration.sql +1 -0
- package/prisma/migrations/20260910000002_add_screen_requires_auth/migration.sql +2 -0
- package/prisma/migrations/20260910000003_add_admin_auth_sessions/migration.sql +17 -0
- package/prisma/migrations/20260916000001_add_admin_last_login/migration.sql +1 -0
- package/prisma/migrations/20260916000002_add_admin_failed_login/migration.sql +2 -0
- package/prisma/migrations/20260916000003_seed_system_tenant/migration.sql +6 -0
- package/prisma/migrations/20260918000000_fix_permissions_comprehensive/migration.sql +63 -0
- package/prisma/migrations/20260924000000_add_screen_role_access/migration.sql +2 -0
- package/prisma/migrations/20260928000000_add_navigation_graph/migration.sql +41 -0
- package/prisma/migrations/20260929000000_artifact_content_hash_suite_unique/migration.sql +25 -0
- package/prisma/migrations/20260929000000_navigation_graph_unique_constraint/migration.sql +5 -0
- package/prisma/migrations/20260929000001_add_membership_status/migration.sql +7 -0
- package/prisma/migrations/20260929000002_add_sso_config_scim_token_hash/migration.sql +8 -0
- package/prisma/migrations/20261005000001_jobs_workers_hardening/migration.sql +63 -0
- package/prisma/migrations/20261009000001_add_suite_category/migration.sql +2 -0
- package/prisma/migrations/20261009000002_add_testcase_approved_fields/migration.sql +3 -0
- package/prisma/migrations/20261012_auto_version_history/migration.sql +111 -0
- package/prisma/migrations/20261015000001_traceability_alignment_gaps/migration.sql +11 -0
- package/prisma/migrations/20261028000001_context_intelligence_p1_p7/migration.sql +76 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +2901 -0
- package/prisma/seed.ts +1262 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
-- Migration: Add GitHub repo connection, coverage mapping tables, and repoTargetPath column
|
|
2
|
+
-- Introduced in commit 0d28ebc (Framework Modernization Phase 2)
|
|
3
|
+
|
|
4
|
+
-- Add repoTargetPath column to TestCase (was missing, causing all testCase queries to 500)
|
|
5
|
+
ALTER TABLE "TestCase" ADD COLUMN IF NOT EXISTS "repoTargetPath" TEXT;
|
|
6
|
+
|
|
7
|
+
-- Create GitHubRepoConnection table
|
|
8
|
+
CREATE TABLE IF NOT EXISTS "GitHubRepoConnection" (
|
|
9
|
+
"id" TEXT NOT NULL,
|
|
10
|
+
"tenantId" TEXT NOT NULL,
|
|
11
|
+
"projectId" TEXT NOT NULL,
|
|
12
|
+
"createdBy" TEXT NOT NULL,
|
|
13
|
+
"repoFullName" TEXT NOT NULL,
|
|
14
|
+
"defaultBranch" TEXT NOT NULL DEFAULT 'main',
|
|
15
|
+
"tokenEnc" TEXT NOT NULL,
|
|
16
|
+
"status" TEXT NOT NULL DEFAULT 'ACTIVE',
|
|
17
|
+
"authMethod" TEXT NOT NULL DEFAULT 'PAT',
|
|
18
|
+
"detectedFramework" TEXT,
|
|
19
|
+
"configFilePath" TEXT,
|
|
20
|
+
"testGlob" TEXT,
|
|
21
|
+
"testIdPattern" TEXT NOT NULL DEFAULT 'TC-[A-Z]+-\\d+',
|
|
22
|
+
"styleProfile" JSONB,
|
|
23
|
+
"treeSnapshot" TEXT,
|
|
24
|
+
"scanStatus" TEXT NOT NULL DEFAULT 'IDLE',
|
|
25
|
+
"scanError" TEXT,
|
|
26
|
+
"testFileCount" INTEGER NOT NULL DEFAULT 0,
|
|
27
|
+
"extractedIdCount" INTEGER NOT NULL DEFAULT 0,
|
|
28
|
+
"lastScannedAt" TIMESTAMP(3),
|
|
29
|
+
"lastSyncAt" TIMESTAMP(3),
|
|
30
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
31
|
+
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
32
|
+
|
|
33
|
+
CONSTRAINT "GitHubRepoConnection_pkey" PRIMARY KEY ("id")
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
CREATE INDEX IF NOT EXISTS "GitHubRepoConnection_tenantId_projectId_idx" ON "GitHubRepoConnection"("tenantId", "projectId");
|
|
37
|
+
CREATE INDEX IF NOT EXISTS "GitHubRepoConnection_tenantId_status_idx" ON "GitHubRepoConnection"("tenantId", "status");
|
|
38
|
+
|
|
39
|
+
ALTER TABLE "GitHubRepoConnection" ADD CONSTRAINT "GitHubRepoConnection_projectId_fkey"
|
|
40
|
+
FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
41
|
+
|
|
42
|
+
-- Create RepoTestFile table
|
|
43
|
+
CREATE TABLE IF NOT EXISTS "RepoTestFile" (
|
|
44
|
+
"id" TEXT NOT NULL,
|
|
45
|
+
"tenantId" TEXT NOT NULL,
|
|
46
|
+
"projectId" TEXT NOT NULL,
|
|
47
|
+
"repoConnectionId" TEXT NOT NULL,
|
|
48
|
+
"filePath" TEXT NOT NULL,
|
|
49
|
+
"framework" TEXT NOT NULL,
|
|
50
|
+
"extractedIds" JSONB NOT NULL DEFAULT '[]',
|
|
51
|
+
"rawSample" TEXT,
|
|
52
|
+
"lastScannedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
53
|
+
|
|
54
|
+
CONSTRAINT "RepoTestFile_pkey" PRIMARY KEY ("id")
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "RepoTestFile_repoConnectionId_filePath_key" ON "RepoTestFile"("repoConnectionId", "filePath");
|
|
58
|
+
CREATE INDEX IF NOT EXISTS "RepoTestFile_tenantId_projectId_idx" ON "RepoTestFile"("tenantId", "projectId");
|
|
59
|
+
CREATE INDEX IF NOT EXISTS "RepoTestFile_repoConnectionId_idx" ON "RepoTestFile"("repoConnectionId");
|
|
60
|
+
|
|
61
|
+
ALTER TABLE "RepoTestFile" ADD CONSTRAINT "RepoTestFile_repoConnectionId_fkey"
|
|
62
|
+
FOREIGN KEY ("repoConnectionId") REFERENCES "GitHubRepoConnection"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
63
|
+
|
|
64
|
+
-- Create CoverageMapping table
|
|
65
|
+
CREATE TABLE IF NOT EXISTS "CoverageMapping" (
|
|
66
|
+
"id" TEXT NOT NULL,
|
|
67
|
+
"tenantId" TEXT NOT NULL,
|
|
68
|
+
"projectId" TEXT NOT NULL,
|
|
69
|
+
"testCaseId" TEXT NOT NULL,
|
|
70
|
+
"repoConnectionId" TEXT NOT NULL,
|
|
71
|
+
"status" TEXT NOT NULL DEFAULT 'UNMAPPED',
|
|
72
|
+
"matchedFilePath" TEXT,
|
|
73
|
+
"scriptTestName" TEXT,
|
|
74
|
+
"lineNumber" INTEGER,
|
|
75
|
+
"confidence" DOUBLE PRECISION,
|
|
76
|
+
"matchMethod" TEXT,
|
|
77
|
+
"manualOverride" BOOLEAN NOT NULL DEFAULT false,
|
|
78
|
+
"confirmedBy" TEXT,
|
|
79
|
+
"confirmedAt" TIMESTAMP(3),
|
|
80
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
81
|
+
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
82
|
+
|
|
83
|
+
CONSTRAINT "CoverageMapping_pkey" PRIMARY KEY ("id")
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "CoverageMapping_testCaseId_key" ON "CoverageMapping"("testCaseId");
|
|
87
|
+
CREATE INDEX IF NOT EXISTS "CoverageMapping_tenantId_projectId_idx" ON "CoverageMapping"("tenantId", "projectId");
|
|
88
|
+
CREATE INDEX IF NOT EXISTS "CoverageMapping_repoConnectionId_idx" ON "CoverageMapping"("repoConnectionId");
|
|
89
|
+
CREATE INDEX IF NOT EXISTS "CoverageMapping_status_projectId_idx" ON "CoverageMapping"("status", "projectId");
|
|
90
|
+
|
|
91
|
+
ALTER TABLE "CoverageMapping" ADD CONSTRAINT "CoverageMapping_testCaseId_fkey"
|
|
92
|
+
FOREIGN KEY ("testCaseId") REFERENCES "TestCase"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
93
|
+
ALTER TABLE "CoverageMapping" ADD CONSTRAINT "CoverageMapping_repoConnectionId_fkey"
|
|
94
|
+
FOREIGN KEY ("repoConnectionId") REFERENCES "GitHubRepoConnection"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
95
|
+
|
|
96
|
+
-- Create CoverageSnapshot table
|
|
97
|
+
CREATE TABLE IF NOT EXISTS "CoverageSnapshot" (
|
|
98
|
+
"id" TEXT NOT NULL,
|
|
99
|
+
"tenantId" TEXT NOT NULL,
|
|
100
|
+
"projectId" TEXT NOT NULL,
|
|
101
|
+
"totalCases" INTEGER NOT NULL,
|
|
102
|
+
"mappedCases" INTEGER NOT NULL,
|
|
103
|
+
"unmappedCases" INTEGER NOT NULL,
|
|
104
|
+
"ambiguousCases" INTEGER NOT NULL,
|
|
105
|
+
"coveragePercent" DOUBLE PRECISION NOT NULL,
|
|
106
|
+
"snapshotAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
107
|
+
|
|
108
|
+
CONSTRAINT "CoverageSnapshot_pkey" PRIMARY KEY ("id")
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
CREATE INDEX IF NOT EXISTS "CoverageSnapshot_tenantId_projectId_snapshotAt_idx" ON "CoverageSnapshot"("tenantId", "projectId", "snapshotAt");
|
|
112
|
+
|
|
113
|
+
ALTER TABLE "CoverageSnapshot" ADD CONSTRAINT "CoverageSnapshot_projectId_fkey"
|
|
114
|
+
FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
-- Migration: GitHub PR tracking + script validation + page object inventory
|
|
2
|
+
-- Adds: GitHubPR table, TestScript validation fields, GitHubRepoConnection extensions
|
|
3
|
+
|
|
4
|
+
-- ── TestScript: validation + PR tracking ────────────────────────────────────
|
|
5
|
+
ALTER TABLE "TestScript"
|
|
6
|
+
ADD COLUMN IF NOT EXISTS "validationStatus" TEXT NOT NULL DEFAULT 'PENDING',
|
|
7
|
+
ADD COLUMN IF NOT EXISTS "validationErrors" TEXT,
|
|
8
|
+
ADD COLUMN IF NOT EXISTS "pushedToPR" BOOLEAN NOT NULL DEFAULT FALSE,
|
|
9
|
+
ADD COLUMN IF NOT EXISTS "pushedPRId" TEXT;
|
|
10
|
+
|
|
11
|
+
-- ── GitHubRepoConnection: page object inventory + GitHub App auth ────────────
|
|
12
|
+
ALTER TABLE "GitHubRepoConnection"
|
|
13
|
+
ADD COLUMN IF NOT EXISTS "pageObjectInventory" JSONB,
|
|
14
|
+
ADD COLUMN IF NOT EXISTS "installationId" INTEGER,
|
|
15
|
+
ADD COLUMN IF NOT EXISTS "authMethod" TEXT NOT NULL DEFAULT 'PAT';
|
|
16
|
+
|
|
17
|
+
-- Backfill authMethod for existing rows that may have PAT/OAUTH strings stored differently
|
|
18
|
+
UPDATE "GitHubRepoConnection" SET "authMethod" = 'PAT' WHERE "authMethod" IS NULL OR "authMethod" = '';
|
|
19
|
+
|
|
20
|
+
-- ── GitHubPR table ───────────────────────────────────────────────────────────
|
|
21
|
+
CREATE TABLE IF NOT EXISTS "GitHubPR" (
|
|
22
|
+
"id" TEXT NOT NULL,
|
|
23
|
+
"tenantId" TEXT NOT NULL,
|
|
24
|
+
"projectId" TEXT NOT NULL,
|
|
25
|
+
"repoConnectionId" TEXT NOT NULL,
|
|
26
|
+
"prNumber" INTEGER NOT NULL,
|
|
27
|
+
"prUrl" TEXT NOT NULL,
|
|
28
|
+
"branch" TEXT NOT NULL,
|
|
29
|
+
"headSha" TEXT NOT NULL,
|
|
30
|
+
"status" TEXT NOT NULL DEFAULT 'OPEN',
|
|
31
|
+
"crawlJobId" TEXT,
|
|
32
|
+
"scriptCount" INTEGER NOT NULL DEFAULT 0,
|
|
33
|
+
"prBody" TEXT,
|
|
34
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
35
|
+
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
36
|
+
|
|
37
|
+
CONSTRAINT "GitHubPR_pkey" PRIMARY KEY ("id")
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
CREATE INDEX IF NOT EXISTS "GitHubPR_tenantId_projectId_idx" ON "GitHubPR"("tenantId", "projectId");
|
|
41
|
+
CREATE INDEX IF NOT EXISTS "GitHubPR_repoConnectionId_idx" ON "GitHubPR"("repoConnectionId");
|
|
42
|
+
CREATE INDEX IF NOT EXISTS "GitHubPR_tenantId_status_idx" ON "GitHubPR"("tenantId", "status");
|
|
43
|
+
|
|
44
|
+
ALTER TABLE "GitHubPR"
|
|
45
|
+
ADD CONSTRAINT "GitHubPR_repoConnectionId_fkey"
|
|
46
|
+
FOREIGN KEY ("repoConnectionId")
|
|
47
|
+
REFERENCES "GitHubRepoConnection"("id")
|
|
48
|
+
ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- Migration: S3 content key pointer fields (DB→S3 pattern, doc 18)
|
|
2
|
+
-- All fields are nullable — existing rows are unaffected; new rows will
|
|
3
|
+
-- set the key when tenant S3 is configured and leave it NULL otherwise.
|
|
4
|
+
|
|
5
|
+
-- TestScript: codeKey for offloading generated automation scripts
|
|
6
|
+
ALTER TABLE "TestScript"
|
|
7
|
+
ADD COLUMN IF NOT EXISTS "codeKey" TEXT;
|
|
8
|
+
|
|
9
|
+
-- ProjectArtifact: contentKey for offloading extracted markdown content
|
|
10
|
+
ALTER TABLE "ProjectArtifact"
|
|
11
|
+
ADD COLUMN IF NOT EXISTS "contentKey" TEXT;
|
|
12
|
+
|
|
13
|
+
-- TestCase: stepsKey and gherkinKey for offloading large step/feature content
|
|
14
|
+
ALTER TABLE "TestCase"
|
|
15
|
+
ADD COLUMN IF NOT EXISTS "stepsKey" TEXT,
|
|
16
|
+
ADD COLUMN IF NOT EXISTS "gherkinKey" TEXT;
|
|
17
|
+
|
|
18
|
+
-- Indexes for S3 key queries (find all records using S3 storage)
|
|
19
|
+
CREATE INDEX IF NOT EXISTS "TestScript_codeKey_idx" ON "TestScript"("codeKey") WHERE "codeKey" IS NOT NULL;
|
|
20
|
+
CREATE INDEX IF NOT EXISTS "ProjectArtifact_contentKey_idx" ON "ProjectArtifact"("contentKey") WHERE "contentKey" IS NOT NULL;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
CREATE TABLE "IdePushToken" (
|
|
2
|
+
"id" TEXT NOT NULL,
|
|
3
|
+
"tenantId" TEXT NOT NULL,
|
|
4
|
+
"projectId" TEXT NOT NULL,
|
|
5
|
+
"suiteId" TEXT,
|
|
6
|
+
"packId" TEXT,
|
|
7
|
+
"language" TEXT NOT NULL DEFAULT 'playwright-ts',
|
|
8
|
+
"tokenHash" TEXT NOT NULL,
|
|
9
|
+
"expiresAt" TIMESTAMP(3) NOT NULL,
|
|
10
|
+
"usedAt" TIMESTAMP(3),
|
|
11
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
12
|
+
CONSTRAINT "IdePushToken_pkey" PRIMARY KEY ("id")
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
CREATE UNIQUE INDEX "IdePushToken_tokenHash_key" ON "IdePushToken"("tokenHash");
|
|
16
|
+
CREATE INDEX "IdePushToken_tenantId_projectId_idx" ON "IdePushToken"("tenantId", "projectId");
|
|
17
|
+
CREATE INDEX "IdePushToken_tokenHash_idx" ON "IdePushToken"("tokenHash");
|
|
18
|
+
CREATE INDEX "IdePushToken_expiresAt_idx" ON "IdePushToken"("expiresAt");
|
|
19
|
+
|
|
20
|
+
ALTER TABLE "IdePushToken" ADD CONSTRAINT "IdePushToken_projectId_fkey"
|
|
21
|
+
FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
-- Migration: add_step_evidence_and_validation
|
|
2
|
+
-- Adds per-step visual evidence caching and manual QA step validation.
|
|
3
|
+
|
|
4
|
+
-- StepEvidence: persisted AI+human element matching per (testCaseId, stepIndex)
|
|
5
|
+
CREATE TABLE "StepEvidence" (
|
|
6
|
+
"id" TEXT NOT NULL,
|
|
7
|
+
"tenantId" TEXT NOT NULL,
|
|
8
|
+
"testCaseId" TEXT NOT NULL,
|
|
9
|
+
"stepIndex" INTEGER NOT NULL,
|
|
10
|
+
"stepText" TEXT NOT NULL,
|
|
11
|
+
"screenshotId" TEXT,
|
|
12
|
+
"elementIds" JSONB NOT NULL DEFAULT '[]',
|
|
13
|
+
"confidence" DOUBLE PRECISION NOT NULL DEFAULT 0,
|
|
14
|
+
"source" TEXT NOT NULL DEFAULT 'ai_heuristic',
|
|
15
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
16
|
+
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
17
|
+
|
|
18
|
+
CONSTRAINT "StepEvidence_pkey" PRIMARY KEY ("id")
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
-- StepValidation: manual QA per-step result (PASS / FAIL / SKIP / BLOCKED)
|
|
22
|
+
CREATE TABLE "StepValidation" (
|
|
23
|
+
"id" TEXT NOT NULL,
|
|
24
|
+
"tenantId" TEXT NOT NULL,
|
|
25
|
+
"testCaseId" TEXT NOT NULL,
|
|
26
|
+
"stepIndex" INTEGER NOT NULL,
|
|
27
|
+
"result" TEXT NOT NULL,
|
|
28
|
+
"comment" TEXT,
|
|
29
|
+
"attachmentUrl" TEXT,
|
|
30
|
+
"testCaseRunId" TEXT,
|
|
31
|
+
"reviewerId" TEXT,
|
|
32
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
33
|
+
|
|
34
|
+
CONSTRAINT "StepValidation_pkey" PRIMARY KEY ("id")
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
-- Unique constraint: one StepEvidence row per (testCaseId, stepIndex)
|
|
38
|
+
CREATE UNIQUE INDEX "StepEvidence_testCaseId_stepIndex_key"
|
|
39
|
+
ON "StepEvidence"("testCaseId", "stepIndex");
|
|
40
|
+
|
|
41
|
+
-- Indexes
|
|
42
|
+
CREATE INDEX "StepEvidence_tenantId_testCaseId_idx"
|
|
43
|
+
ON "StepEvidence"("tenantId", "testCaseId");
|
|
44
|
+
|
|
45
|
+
CREATE INDEX "StepValidation_tenantId_testCaseId_idx"
|
|
46
|
+
ON "StepValidation"("tenantId", "testCaseId");
|
|
47
|
+
|
|
48
|
+
CREATE INDEX "StepValidation_testCaseId_stepIndex_idx"
|
|
49
|
+
ON "StepValidation"("testCaseId", "stepIndex");
|
|
50
|
+
|
|
51
|
+
-- Foreign keys
|
|
52
|
+
ALTER TABLE "StepEvidence"
|
|
53
|
+
ADD CONSTRAINT "StepEvidence_screenshotId_fkey"
|
|
54
|
+
FOREIGN KEY ("screenshotId")
|
|
55
|
+
REFERENCES "Screenshot"("id")
|
|
56
|
+
ON DELETE SET NULL ON UPDATE CASCADE;
|
|
57
|
+
|
|
58
|
+
ALTER TABLE "StepEvidence"
|
|
59
|
+
ADD CONSTRAINT "StepEvidence_testCaseId_fkey"
|
|
60
|
+
FOREIGN KEY ("testCaseId")
|
|
61
|
+
REFERENCES "TestCase"("id")
|
|
62
|
+
ON DELETE CASCADE ON UPDATE CASCADE;
|
|
63
|
+
|
|
64
|
+
ALTER TABLE "StepValidation"
|
|
65
|
+
ADD CONSTRAINT "StepValidation_testCaseRunId_fkey"
|
|
66
|
+
FOREIGN KEY ("testCaseRunId")
|
|
67
|
+
REFERENCES "TestCaseRun"("id")
|
|
68
|
+
ON DELETE SET NULL ON UPDATE CASCADE;
|
|
69
|
+
|
|
70
|
+
ALTER TABLE "StepValidation"
|
|
71
|
+
ADD CONSTRAINT "StepValidation_reviewerId_fkey"
|
|
72
|
+
FOREIGN KEY ("reviewerId")
|
|
73
|
+
REFERENCES "User"("id")
|
|
74
|
+
ON DELETE SET NULL ON UPDATE CASCADE;
|
|
75
|
+
|
|
76
|
+
ALTER TABLE "StepValidation"
|
|
77
|
+
ADD CONSTRAINT "StepValidation_testCaseId_fkey"
|
|
78
|
+
FOREIGN KEY ("testCaseId")
|
|
79
|
+
REFERENCES "TestCase"("id")
|
|
80
|
+
ON DELETE CASCADE ON UPDATE CASCADE;
|
|
81
|
+
|
|
82
|
+
-- Auto-update updatedAt on StepEvidence
|
|
83
|
+
CREATE OR REPLACE FUNCTION update_step_evidence_updated_at()
|
|
84
|
+
RETURNS TRIGGER AS $$
|
|
85
|
+
BEGIN
|
|
86
|
+
NEW."updatedAt" = NOW();
|
|
87
|
+
RETURN NEW;
|
|
88
|
+
END;
|
|
89
|
+
$$ LANGUAGE plpgsql;
|
|
90
|
+
|
|
91
|
+
CREATE TRIGGER step_evidence_updated_at
|
|
92
|
+
BEFORE UPDATE ON "StepEvidence"
|
|
93
|
+
FOR EACH ROW EXECUTE FUNCTION update_step_evidence_updated_at();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
-- Migration: add_tenantId_to_test_data_row (SCHEMA-01)
|
|
2
|
+
--
|
|
3
|
+
-- TestDataRow lacked a tenantId column, so no RLS policy could be applied.
|
|
4
|
+
-- This migration:
|
|
5
|
+
-- 1. Adds the tenantId column (nullable temporarily for backfill)
|
|
6
|
+
-- 2. Backfills tenantId from the parent TestDataSet
|
|
7
|
+
-- 3. Sets the column NOT NULL
|
|
8
|
+
-- 4. Adds an index for query performance
|
|
9
|
+
-- 5. Enables Row-Level Security with the standard tenant_isolation policy
|
|
10
|
+
--
|
|
11
|
+
-- Idempotent: guarded against duplicate_object errors on the policy creation.
|
|
12
|
+
|
|
13
|
+
-- Step 1: add column as nullable so existing rows don't violate NOT NULL
|
|
14
|
+
ALTER TABLE "TestDataRow" ADD COLUMN IF NOT EXISTS "tenantId" TEXT;
|
|
15
|
+
|
|
16
|
+
-- Step 2: backfill from parent TestDataSet
|
|
17
|
+
UPDATE "TestDataRow" tr
|
|
18
|
+
SET "tenantId" = ds."tenantId"
|
|
19
|
+
FROM "TestDataSet" ds
|
|
20
|
+
WHERE tr."dataSetId" = ds."id"
|
|
21
|
+
AND tr."tenantId" IS NULL;
|
|
22
|
+
|
|
23
|
+
-- Step 3: enforce NOT NULL now that all rows are populated
|
|
24
|
+
ALTER TABLE "TestDataRow" ALTER COLUMN "tenantId" SET NOT NULL;
|
|
25
|
+
|
|
26
|
+
-- Step 4: index for tenant-scoped queries
|
|
27
|
+
CREATE INDEX IF NOT EXISTS "TestDataRow_tenantId_idx" ON "TestDataRow"("tenantId");
|
|
28
|
+
|
|
29
|
+
-- Step 5: enable RLS with the standard tenant isolation policy
|
|
30
|
+
ALTER TABLE "TestDataRow" ENABLE ROW LEVEL SECURITY;
|
|
31
|
+
ALTER TABLE "TestDataRow" FORCE ROW LEVEL SECURITY;
|
|
32
|
+
|
|
33
|
+
DO $$
|
|
34
|
+
BEGIN
|
|
35
|
+
CREATE POLICY tenant_isolation ON "TestDataRow"
|
|
36
|
+
USING ("tenantId" = current_setting('app.current_tenant', true))
|
|
37
|
+
WITH CHECK ("tenantId" = current_setting('app.current_tenant', true));
|
|
38
|
+
EXCEPTION WHEN duplicate_object THEN
|
|
39
|
+
NULL; -- policy already exists, skip
|
|
40
|
+
END $$;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- Add classification and environment to TestDataSet
|
|
2
|
+
ALTER TABLE "TestDataSet" ADD COLUMN "classification" TEXT NOT NULL DEFAULT 'SYNTHETIC';
|
|
3
|
+
ALTER TABLE "TestDataSet" ADD COLUMN "environment" TEXT;
|
|
4
|
+
|
|
5
|
+
-- Add indexed source column to TestData (was previously only in payload JSON)
|
|
6
|
+
ALTER TABLE "TestData" ADD COLUMN "source" TEXT NOT NULL DEFAULT 'SYNTHETIC';
|
|
7
|
+
|
|
8
|
+
-- Backfill source from payload JSON for existing rows
|
|
9
|
+
UPDATE "TestData"
|
|
10
|
+
SET "source" = CASE
|
|
11
|
+
WHEN payload->>'source' = 'fallback' THEN 'FALLBACK'
|
|
12
|
+
WHEN payload->>'source' = 'generated' THEN 'SYNTHETIC'
|
|
13
|
+
ELSE 'SYNTHETIC'
|
|
14
|
+
END;
|
|
15
|
+
|
|
16
|
+
-- Indexes
|
|
17
|
+
CREATE INDEX "TestDataSet_tenantId_classification_idx" ON "TestDataSet"("tenantId", "classification");
|
|
18
|
+
CREATE INDEX "TestData_tenantId_source_idx" ON "TestData"("tenantId", "source");
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
-- Add LLM-generated guidance notes to TestCase
|
|
2
|
+
-- dataNote: guidance for the data-agent (field constraints, personas, boundary values)
|
|
3
|
+
-- scriptNote: guidance for the script-agent (preconditions, dynamic extractions, parallelism)
|
|
4
|
+
ALTER TABLE "TestCase" ADD COLUMN "dataNote" TEXT;
|
|
5
|
+
ALTER TABLE "TestCase" ADD COLUMN "scriptNote" TEXT;
|
package/prisma/migrations/20260807000002_add_visual_baseline_browser_structured_steps/migration.sql
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- Add browser column to VisualBaseline for cross-browser baseline support
|
|
2
|
+
ALTER TABLE "VisualBaseline" ADD COLUMN "browser" TEXT NOT NULL DEFAULT 'chromium';
|
|
3
|
+
|
|
4
|
+
-- Drop old unique constraint (screenId, viewport, gitBranch)
|
|
5
|
+
DROP INDEX IF EXISTS "VisualBaseline_screenId_viewport_gitBranch_key";
|
|
6
|
+
|
|
7
|
+
-- Create new unique constraint with browser dimension
|
|
8
|
+
CREATE UNIQUE INDEX "VisualBaseline_screenId_viewport_gitBranch_browser_key" ON "VisualBaseline"("screenId", "viewport", "gitBranch", "browser");
|
|
9
|
+
|
|
10
|
+
-- Add structuredSteps to TestCase for machine-readable step format
|
|
11
|
+
ALTER TABLE "TestCase" ADD COLUMN "structuredSteps" JSONB;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- TenantPlanConfig: admin-configurable tier limits (overrides hardcoded defaults)
|
|
2
|
+
CREATE TABLE IF NOT EXISTS "TenantPlanConfig" (
|
|
3
|
+
"tier" TEXT NOT NULL,
|
|
4
|
+
"maxProjects" INTEGER NOT NULL,
|
|
5
|
+
"maxMembers" INTEGER NOT NULL,
|
|
6
|
+
"maxSessions" INTEGER NOT NULL,
|
|
7
|
+
"maxCrawlsPerMonth" INTEGER NOT NULL,
|
|
8
|
+
"maxRunsPerMonth" INTEGER NOT NULL,
|
|
9
|
+
"maxShards" INTEGER NOT NULL,
|
|
10
|
+
"maxTokensPerMonth" INTEGER NOT NULL,
|
|
11
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
12
|
+
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
13
|
+
CONSTRAINT "TenantPlanConfig_pkey" PRIMARY KEY ("tier")
|
|
14
|
+
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- AgentToken is missing createdByUserId and expiresAt columns.
|
|
2
|
+
-- These were added to the Prisma schema but never migrated to the DB,
|
|
3
|
+
-- causing 500 errors on POST /projects/:id/agent-tokens (INSERT fails with
|
|
4
|
+
-- "column does not exist").
|
|
5
|
+
|
|
6
|
+
ALTER TABLE "AgentToken"
|
|
7
|
+
ADD COLUMN IF NOT EXISTS "expiresAt" TIMESTAMP(3),
|
|
8
|
+
ADD COLUMN IF NOT EXISTS "createdByUserId" TEXT;
|
|
9
|
+
|
|
10
|
+
-- FK to User (nullable — workspace tokens may not have a creator on record)
|
|
11
|
+
ALTER TABLE "AgentToken"
|
|
12
|
+
ADD CONSTRAINT "AgentToken_createdByUserId_fkey"
|
|
13
|
+
FOREIGN KEY ("createdByUserId") REFERENCES "User"("id")
|
|
14
|
+
ON DELETE SET NULL ON UPDATE CASCADE;
|
|
15
|
+
|
|
16
|
+
-- Also fix projectId FK to match schema's onDelete: SetNull
|
|
17
|
+
-- (original migration had RESTRICT; schema expects SET NULL so project deletes don't error)
|
|
18
|
+
ALTER TABLE "AgentToken" DROP CONSTRAINT IF EXISTS "AgentToken_projectId_fkey";
|
|
19
|
+
ALTER TABLE "AgentToken"
|
|
20
|
+
ADD CONSTRAINT "AgentToken_projectId_fkey"
|
|
21
|
+
FOREIGN KEY ("projectId") REFERENCES "Project"("id")
|
|
22
|
+
ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- R5: Store the pixelmatch diff image URL alongside new screenshot
|
|
2
|
+
-- R7: Per-project visual diff threshold (minimum pHash % to flag as changed)
|
|
3
|
+
|
|
4
|
+
ALTER TABLE "VisualDiff"
|
|
5
|
+
ADD COLUMN IF NOT EXISTS "diffImageCloudUrl" TEXT;
|
|
6
|
+
|
|
7
|
+
ALTER TABLE "Project"
|
|
8
|
+
ADD COLUMN IF NOT EXISTS "visualDiffThreshold" DOUBLE PRECISION;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- SsoConfig.emailDomains (String[] in schema) was added to the model but
|
|
2
|
+
-- never included in the CREATE TABLE (20260707180000_add_missing_tables) or any
|
|
3
|
+
-- subsequent ALTER TABLE. Referenced in sso.ts:347,530,572,627 for JIT
|
|
4
|
+
-- provisioning domain whitelist. Breaks SSO login and config reads without it.
|
|
5
|
+
|
|
6
|
+
ALTER TABLE "SsoConfig"
|
|
7
|
+
ADD COLUMN IF NOT EXISTS "emailDomains" TEXT[] NOT NULL DEFAULT ARRAY[]::TEXT[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- Add missing fields to Project model
|
|
2
|
+
ALTER TABLE "Project" ADD COLUMN IF NOT EXISTS "description" TEXT;
|
|
3
|
+
ALTER TABLE "Project" ADD COLUMN IF NOT EXISTS "status" TEXT NOT NULL DEFAULT 'ACTIVE';
|
|
4
|
+
ALTER TABLE "Project" ADD COLUMN IF NOT EXISTS "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
|
5
|
+
|
|
6
|
+
-- Backfill updatedAt with createdAt for existing rows
|
|
7
|
+
UPDATE "Project" SET "updatedAt" = "createdAt" WHERE "updatedAt" = CURRENT_TIMESTAMP AND "createdAt" < CURRENT_TIMESTAMP;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- Add contentHash for content-based deduplication of AI-generated test cases.
|
|
2
|
+
-- Replaces title-only dedup so paraphrased duplicates across 21 passes are caught.
|
|
3
|
+
|
|
4
|
+
ALTER TABLE "TestCase" ADD COLUMN "contentHash" TEXT;
|
|
5
|
+
|
|
6
|
+
CREATE INDEX "TestCase_suiteId_contentHash_idx" ON "TestCase"("suiteId", "contentHash");
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- Migration: add locatorsJson and locatorsExtractedAt to TestCase
|
|
2
|
+
-- Stores extracted Playwright locator expressions per test case.
|
|
3
|
+
-- Shape: [{key, expression, elementType, confidence, source, description}]
|
|
4
|
+
|
|
5
|
+
ALTER TABLE "TestCase" ADD COLUMN IF NOT EXISTS "locatorsJson" JSONB;
|
|
6
|
+
ALTER TABLE "TestCase" ADD COLUMN IF NOT EXISTS "locatorsExtractedAt" TIMESTAMP(3);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "TestCaseVersion" (
|
|
3
|
+
"id" TEXT NOT NULL,
|
|
4
|
+
"testCaseId" TEXT NOT NULL,
|
|
5
|
+
"versionNum" INTEGER NOT NULL,
|
|
6
|
+
"title" TEXT NOT NULL,
|
|
7
|
+
"steps" JSONB,
|
|
8
|
+
"preconditions" TEXT,
|
|
9
|
+
"expectedResult" TEXT,
|
|
10
|
+
"kind" TEXT,
|
|
11
|
+
"priority" TEXT,
|
|
12
|
+
"snapshot" JSONB NOT NULL,
|
|
13
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
14
|
+
"createdBy" TEXT,
|
|
15
|
+
"tenantId" TEXT NOT NULL,
|
|
16
|
+
|
|
17
|
+
CONSTRAINT "TestCaseVersion_pkey" PRIMARY KEY ("id")
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
-- CreateIndex
|
|
21
|
+
CREATE INDEX "TestCaseVersion_testCaseId_versionNum_idx" ON "TestCaseVersion"("testCaseId", "versionNum");
|
|
22
|
+
|
|
23
|
+
-- CreateIndex
|
|
24
|
+
CREATE INDEX "TestCaseVersion_tenantId_testCaseId_idx" ON "TestCaseVersion"("tenantId", "testCaseId");
|
|
25
|
+
|
|
26
|
+
-- AddForeignKey
|
|
27
|
+
ALTER TABLE "TestCaseVersion" ADD CONSTRAINT "TestCaseVersion_testCaseId_fkey" FOREIGN KEY ("testCaseId") REFERENCES "TestCase"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "TestCase" ADD COLUMN "captureStepScreenshots" JSONB;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- Gap 30: Dead-letter queue and automatic retry for failed PlatformJob records.
|
|
2
|
+
-- Adds retry tracking fields and a composite index for the retry worker query.
|
|
3
|
+
|
|
4
|
+
ALTER TABLE "PlatformJob" ADD COLUMN IF NOT EXISTS "retryCount" INTEGER NOT NULL DEFAULT 0;
|
|
5
|
+
ALTER TABLE "PlatformJob" ADD COLUMN IF NOT EXISTS "nextRetryAt" TIMESTAMP(3);
|
|
6
|
+
ALTER TABLE "PlatformJob" ADD COLUMN IF NOT EXISTS "dlq" BOOLEAN NOT NULL DEFAULT false;
|
|
7
|
+
ALTER TABLE "PlatformJob" ADD COLUMN IF NOT EXISTS "dlqReason" TEXT;
|
|
8
|
+
|
|
9
|
+
-- Index for the retry worker's eligibility query (status=FAILED, dlq=false, nextRetryAt<=now)
|
|
10
|
+
CREATE INDEX IF NOT EXISTS "PlatformJob_status_dlq_nextRetryAt_idx" ON "PlatformJob"("status", "dlq", "nextRetryAt");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
-- Add soft-delete column to TestData for version history
|
|
2
|
+
ALTER TABLE "TestData" ADD COLUMN "supersededAt" TIMESTAMP(3);
|
|
3
|
+
|
|
4
|
+
-- Index for active-only queries (WHERE supersededAt IS NULL)
|
|
5
|
+
CREATE INDEX "TestData_tenantId_testCaseId_supersededAt_idx" ON "TestData"("tenantId", "testCaseId", "supersededAt");
|
|
6
|
+
|
|
7
|
+
-- Snapshot table for TestScript version history
|
|
8
|
+
CREATE TABLE "TestScriptVersion" (
|
|
9
|
+
"id" TEXT NOT NULL,
|
|
10
|
+
"tenantId" TEXT NOT NULL,
|
|
11
|
+
"testCaseId" TEXT NOT NULL,
|
|
12
|
+
"language" TEXT NOT NULL,
|
|
13
|
+
"code" TEXT NOT NULL,
|
|
14
|
+
"versionNum" INTEGER NOT NULL,
|
|
15
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
16
|
+
|
|
17
|
+
CONSTRAINT "TestScriptVersion_pkey" PRIMARY KEY ("id")
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
CREATE INDEX "TestScriptVersion_testCaseId_language_idx" ON "TestScriptVersion"("testCaseId", "language");
|
|
21
|
+
CREATE INDEX "TestScriptVersion_tenantId_testCaseId_idx" ON "TestScriptVersion"("tenantId", "testCaseId");
|
|
22
|
+
|
|
23
|
+
-- Snapshot table for SkillFile version history (TEST_PLAN and others)
|
|
24
|
+
CREATE TABLE "SkillFileVersion" (
|
|
25
|
+
"id" TEXT NOT NULL,
|
|
26
|
+
"tenantId" TEXT NOT NULL,
|
|
27
|
+
"projectId" TEXT NOT NULL,
|
|
28
|
+
"skillFileId" TEXT NOT NULL,
|
|
29
|
+
"kind" TEXT NOT NULL,
|
|
30
|
+
"content" TEXT NOT NULL,
|
|
31
|
+
"versionNum" INTEGER NOT NULL,
|
|
32
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
33
|
+
|
|
34
|
+
CONSTRAINT "SkillFileVersion_pkey" PRIMARY KEY ("id")
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
CREATE INDEX "SkillFileVersion_skillFileId_versionNum_idx" ON "SkillFileVersion"("skillFileId", "versionNum");
|
|
38
|
+
CREATE INDEX "SkillFileVersion_tenantId_projectId_kind_idx" ON "SkillFileVersion"("tenantId", "projectId", "kind");
|