@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,606 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `lighthouseReport` on the `PerformanceSnapshot` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the column `appiumSessionId` on the `PlatformJob` table. All the data in the column will be lost.
|
|
6
|
+
- You are about to drop the column `deviceFarm` on the `PlatformJob` table. All the data in the column will be lost.
|
|
7
|
+
- You are about to drop the column `deviceModel` on the `PlatformJob` table. All the data in the column will be lost.
|
|
8
|
+
- You are about to drop the column `osVersion` on the `PlatformJob` table. All the data in the column will be lost.
|
|
9
|
+
- You are about to drop the column `a11yViolations` on the `Screen` table. All the data in the column will be lost.
|
|
10
|
+
- You are about to drop the column `securityHeaders` on the `Screen` table. All the data in the column will be lost.
|
|
11
|
+
- You are about to drop the column `genAt` on the `TestCase` table. All the data in the column will be lost.
|
|
12
|
+
- You are about to drop the column `dataRow` on the `TestResult` table. All the data in the column will be lost.
|
|
13
|
+
- You are about to drop the column `networkTimings` on the `TestResult` table. All the data in the column will be lost.
|
|
14
|
+
- You are about to drop the column `rootCauseSummary` on the `TestResult` table. All the data in the column will be lost.
|
|
15
|
+
- You are about to drop the column `domSnapshotPath` on the `VisualBaseline` table. All the data in the column will be lost.
|
|
16
|
+
- Added the required column `updatedAt` to the `TestCase` table without a default value. This is not possible if the table is not empty.
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
-- DropForeignKey
|
|
20
|
+
DO $$ BEGIN
|
|
21
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'AccessReview_tenantId_fkey') THEN
|
|
22
|
+
ALTER TABLE "AccessReview" DROP CONSTRAINT "AccessReview_tenantId_fkey";
|
|
23
|
+
END IF;
|
|
24
|
+
END $$;
|
|
25
|
+
|
|
26
|
+
-- DropForeignKey
|
|
27
|
+
DO $$ BEGIN
|
|
28
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'Element_screenId_fkey') THEN
|
|
29
|
+
ALTER TABLE "Element" DROP CONSTRAINT "Element_screenId_fkey";
|
|
30
|
+
END IF;
|
|
31
|
+
END $$;
|
|
32
|
+
|
|
33
|
+
-- DropForeignKey
|
|
34
|
+
DO $$ BEGIN
|
|
35
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ElementFingerprint_projectId_fkey') THEN
|
|
36
|
+
ALTER TABLE "ElementFingerprint" DROP CONSTRAINT "ElementFingerprint_projectId_fkey";
|
|
37
|
+
END IF;
|
|
38
|
+
END $$;
|
|
39
|
+
|
|
40
|
+
-- DropForeignKey
|
|
41
|
+
DO $$ BEGIN
|
|
42
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'HumanReviewItem_projectId_fkey') THEN
|
|
43
|
+
ALTER TABLE "HumanReviewItem" DROP CONSTRAINT "HumanReviewItem_projectId_fkey";
|
|
44
|
+
END IF;
|
|
45
|
+
END $$;
|
|
46
|
+
|
|
47
|
+
-- DropForeignKey
|
|
48
|
+
DO $$ BEGIN
|
|
49
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'KnowledgeChunk_projectId_fkey') THEN
|
|
50
|
+
ALTER TABLE "KnowledgeChunk" DROP CONSTRAINT "KnowledgeChunk_projectId_fkey";
|
|
51
|
+
END IF;
|
|
52
|
+
END $$;
|
|
53
|
+
|
|
54
|
+
-- DropForeignKey
|
|
55
|
+
DO $$ BEGIN
|
|
56
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'LLMCallLog_projectId_fkey') THEN
|
|
57
|
+
ALTER TABLE "LLMCallLog" DROP CONSTRAINT "LLMCallLog_projectId_fkey";
|
|
58
|
+
END IF;
|
|
59
|
+
END $$;
|
|
60
|
+
|
|
61
|
+
-- DropForeignKey
|
|
62
|
+
DO $$ BEGIN
|
|
63
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'Notification_tenantId_fkey') THEN
|
|
64
|
+
ALTER TABLE "Notification" DROP CONSTRAINT "Notification_tenantId_fkey";
|
|
65
|
+
END IF;
|
|
66
|
+
END $$;
|
|
67
|
+
|
|
68
|
+
-- DropForeignKey
|
|
69
|
+
DO $$ BEGIN
|
|
70
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'Notification_userId_fkey') THEN
|
|
71
|
+
ALTER TABLE "Notification" DROP CONSTRAINT "Notification_userId_fkey";
|
|
72
|
+
END IF;
|
|
73
|
+
END $$;
|
|
74
|
+
|
|
75
|
+
-- DropForeignKey
|
|
76
|
+
DO $$ BEGIN
|
|
77
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'NotificationPreference_tenantId_fkey') THEN
|
|
78
|
+
ALTER TABLE "NotificationPreference" DROP CONSTRAINT "NotificationPreference_tenantId_fkey";
|
|
79
|
+
END IF;
|
|
80
|
+
END $$;
|
|
81
|
+
|
|
82
|
+
-- DropForeignKey
|
|
83
|
+
DO $$ BEGIN
|
|
84
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'NotificationPreference_userId_fkey') THEN
|
|
85
|
+
ALTER TABLE "NotificationPreference" DROP CONSTRAINT "NotificationPreference_userId_fkey";
|
|
86
|
+
END IF;
|
|
87
|
+
END $$;
|
|
88
|
+
|
|
89
|
+
-- DropForeignKey
|
|
90
|
+
DO $$ BEGIN
|
|
91
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ProbeObservation_projectId_fkey') THEN
|
|
92
|
+
ALTER TABLE "ProbeObservation" DROP CONSTRAINT "ProbeObservation_projectId_fkey";
|
|
93
|
+
END IF;
|
|
94
|
+
END $$;
|
|
95
|
+
|
|
96
|
+
-- DropForeignKey
|
|
97
|
+
DO $$ BEGIN
|
|
98
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ProbeObservation_screenId_fkey') THEN
|
|
99
|
+
ALTER TABLE "ProbeObservation" DROP CONSTRAINT "ProbeObservation_screenId_fkey";
|
|
100
|
+
END IF;
|
|
101
|
+
END $$;
|
|
102
|
+
|
|
103
|
+
-- DropForeignKey
|
|
104
|
+
DO $$ BEGIN
|
|
105
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'Screen_projectId_fkey') THEN
|
|
106
|
+
ALTER TABLE "Screen" DROP CONSTRAINT "Screen_projectId_fkey";
|
|
107
|
+
END IF;
|
|
108
|
+
END $$;
|
|
109
|
+
|
|
110
|
+
-- DropForeignKey
|
|
111
|
+
DO $$ BEGIN
|
|
112
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ScreenA11yViolation_projectId_fkey') THEN
|
|
113
|
+
ALTER TABLE "ScreenA11yViolation" DROP CONSTRAINT "ScreenA11yViolation_projectId_fkey";
|
|
114
|
+
END IF;
|
|
115
|
+
END $$;
|
|
116
|
+
|
|
117
|
+
-- DropForeignKey
|
|
118
|
+
DO $$ BEGIN
|
|
119
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ScreenA11yViolation_screenId_fkey') THEN
|
|
120
|
+
ALTER TABLE "ScreenA11yViolation" DROP CONSTRAINT "ScreenA11yViolation_screenId_fkey";
|
|
121
|
+
END IF;
|
|
122
|
+
END $$;
|
|
123
|
+
|
|
124
|
+
-- DropForeignKey
|
|
125
|
+
DO $$ BEGIN
|
|
126
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ScreenDiff_projectId_fkey') THEN
|
|
127
|
+
ALTER TABLE "ScreenDiff" DROP CONSTRAINT "ScreenDiff_projectId_fkey";
|
|
128
|
+
END IF;
|
|
129
|
+
END $$;
|
|
130
|
+
|
|
131
|
+
-- DropForeignKey
|
|
132
|
+
DO $$ BEGIN
|
|
133
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ScreenDiff_screenId_fkey') THEN
|
|
134
|
+
ALTER TABLE "ScreenDiff" DROP CONSTRAINT "ScreenDiff_screenId_fkey";
|
|
135
|
+
END IF;
|
|
136
|
+
END $$;
|
|
137
|
+
|
|
138
|
+
-- DropForeignKey
|
|
139
|
+
DO $$ BEGIN
|
|
140
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'SlackConnection_tenantId_fkey') THEN
|
|
141
|
+
ALTER TABLE "SlackConnection" DROP CONSTRAINT "SlackConnection_tenantId_fkey";
|
|
142
|
+
END IF;
|
|
143
|
+
END $$;
|
|
144
|
+
|
|
145
|
+
-- DropForeignKey
|
|
146
|
+
DO $$ BEGIN
|
|
147
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'SsoConfig_tenantId_fkey') THEN
|
|
148
|
+
ALTER TABLE "SsoConfig" DROP CONSTRAINT "SsoConfig_tenantId_fkey";
|
|
149
|
+
END IF;
|
|
150
|
+
END $$;
|
|
151
|
+
|
|
152
|
+
-- DropForeignKey
|
|
153
|
+
DO $$ BEGIN
|
|
154
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TeamsConnection_tenantId_fkey') THEN
|
|
155
|
+
ALTER TABLE "TeamsConnection" DROP CONSTRAINT "TeamsConnection_tenantId_fkey";
|
|
156
|
+
END IF;
|
|
157
|
+
END $$;
|
|
158
|
+
|
|
159
|
+
-- DropForeignKey
|
|
160
|
+
DO $$ BEGIN
|
|
161
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TenantPlan_tenantId_fkey') THEN
|
|
162
|
+
ALTER TABLE "TenantPlan" DROP CONSTRAINT "TenantPlan_tenantId_fkey";
|
|
163
|
+
END IF;
|
|
164
|
+
END $$;
|
|
165
|
+
|
|
166
|
+
-- DropForeignKey
|
|
167
|
+
DO $$ BEGIN
|
|
168
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TenantSiloConfig_tenantId_fkey') THEN
|
|
169
|
+
ALTER TABLE "TenantSiloConfig" DROP CONSTRAINT "TenantSiloConfig_tenantId_fkey";
|
|
170
|
+
END IF;
|
|
171
|
+
END $$;
|
|
172
|
+
|
|
173
|
+
-- DropForeignKey
|
|
174
|
+
DO $$ BEGIN
|
|
175
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestCase_dataSetId_fkey') THEN
|
|
176
|
+
ALTER TABLE "TestCase" DROP CONSTRAINT "TestCase_dataSetId_fkey";
|
|
177
|
+
END IF;
|
|
178
|
+
END $$;
|
|
179
|
+
|
|
180
|
+
-- DropForeignKey
|
|
181
|
+
DO $$ BEGIN
|
|
182
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestData_projectId_fkey') THEN
|
|
183
|
+
ALTER TABLE "TestData" DROP CONSTRAINT "TestData_projectId_fkey";
|
|
184
|
+
END IF;
|
|
185
|
+
END $$;
|
|
186
|
+
|
|
187
|
+
-- DropForeignKey
|
|
188
|
+
DO $$ BEGIN
|
|
189
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestDataRow_dataSetId_fkey') THEN
|
|
190
|
+
ALTER TABLE "TestDataRow" DROP CONSTRAINT "TestDataRow_dataSetId_fkey";
|
|
191
|
+
END IF;
|
|
192
|
+
END $$;
|
|
193
|
+
|
|
194
|
+
-- DropForeignKey
|
|
195
|
+
DO $$ BEGIN
|
|
196
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestDataSet_projectId_fkey') THEN
|
|
197
|
+
ALTER TABLE "TestDataSet" DROP CONSTRAINT "TestDataSet_projectId_fkey";
|
|
198
|
+
END IF;
|
|
199
|
+
END $$;
|
|
200
|
+
|
|
201
|
+
-- DropForeignKey
|
|
202
|
+
DO $$ BEGIN
|
|
203
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestRunShard_runId_fkey') THEN
|
|
204
|
+
ALTER TABLE "TestRunShard" DROP CONSTRAINT "TestRunShard_runId_fkey";
|
|
205
|
+
END IF;
|
|
206
|
+
END $$;
|
|
207
|
+
|
|
208
|
+
-- DropForeignKey
|
|
209
|
+
DO $$ BEGIN
|
|
210
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestScript_projectId_fkey') THEN
|
|
211
|
+
ALTER TABLE "TestScript" DROP CONSTRAINT "TestScript_projectId_fkey";
|
|
212
|
+
END IF;
|
|
213
|
+
END $$;
|
|
214
|
+
|
|
215
|
+
-- DropForeignKey
|
|
216
|
+
DO $$ BEGIN
|
|
217
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestSuite_projectId_fkey') THEN
|
|
218
|
+
ALTER TABLE "TestSuite" DROP CONSTRAINT "TestSuite_projectId_fkey";
|
|
219
|
+
END IF;
|
|
220
|
+
END $$;
|
|
221
|
+
|
|
222
|
+
-- DropForeignKey
|
|
223
|
+
DO $$ BEGIN
|
|
224
|
+
IF EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'VisualBaseline_projectId_fkey') THEN
|
|
225
|
+
ALTER TABLE "VisualBaseline" DROP CONSTRAINT "VisualBaseline_projectId_fkey";
|
|
226
|
+
END IF;
|
|
227
|
+
END $$;
|
|
228
|
+
|
|
229
|
+
-- DropIndex
|
|
230
|
+
DROP INDEX IF EXISTS "KnowledgeChunk_tsv_idx";
|
|
231
|
+
|
|
232
|
+
-- DropIndex
|
|
233
|
+
DROP INDEX IF EXISTS "PlatformJob_status_heartbeatAt_idx";
|
|
234
|
+
|
|
235
|
+
-- DropIndex
|
|
236
|
+
DROP INDEX IF EXISTS "PlatformJob_tenantId_projectId_queuedAt_idx";
|
|
237
|
+
|
|
238
|
+
-- DropIndex
|
|
239
|
+
DROP INDEX IF EXISTS "Screen_tenantId_projectId_discoveryMethod_idx";
|
|
240
|
+
|
|
241
|
+
-- DropIndex
|
|
242
|
+
DROP INDEX IF EXISTS "ScreenGroup_tenantId_projectId_crawlJobId_idx";
|
|
243
|
+
|
|
244
|
+
-- AlterTable
|
|
245
|
+
ALTER TABLE "ActionRecipe" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
246
|
+
|
|
247
|
+
-- AlterTable
|
|
248
|
+
ALTER TABLE "AdminUser" ADD COLUMN IF NOT EXISTS "role" TEXT NOT NULL DEFAULT 'SUPER_ADMIN';
|
|
249
|
+
|
|
250
|
+
-- AlterTable
|
|
251
|
+
ALTER TABLE "AppField" ALTER COLUMN "piiClass" SET DEFAULT 'unknown';
|
|
252
|
+
|
|
253
|
+
-- AlterTable
|
|
254
|
+
ALTER TABLE "Comment" ALTER COLUMN "userId" DROP NOT NULL;
|
|
255
|
+
|
|
256
|
+
-- AlterTable
|
|
257
|
+
ALTER TABLE "CoverageMapping" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
258
|
+
|
|
259
|
+
-- AlterTable
|
|
260
|
+
ALTER TABLE "GitHubPR" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
261
|
+
|
|
262
|
+
-- AlterTable
|
|
263
|
+
ALTER TABLE "GitHubRepoConnection" ALTER COLUMN "testIdPattern" SET DEFAULT 'TC-[A-Z]+-\d+',
|
|
264
|
+
ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
265
|
+
|
|
266
|
+
-- AlterTable
|
|
267
|
+
-- FIX: tsv is a generated column; DROP DEFAULT fails — use DROP EXPRESSION instead
|
|
268
|
+
ALTER TABLE "KnowledgeChunk" ALTER COLUMN "tsv" DROP EXPRESSION IF EXISTS;
|
|
269
|
+
|
|
270
|
+
-- AlterTable
|
|
271
|
+
ALTER TABLE "PerformanceSnapshot" DROP COLUMN IF EXISTS "lighthouseReport",
|
|
272
|
+
ALTER COLUMN "lighthousePerf" SET DATA TYPE DOUBLE PRECISION,
|
|
273
|
+
ALTER COLUMN "lighthouseA11y" SET DATA TYPE DOUBLE PRECISION,
|
|
274
|
+
ALTER COLUMN "lighthouseSEO" SET DATA TYPE DOUBLE PRECISION,
|
|
275
|
+
ALTER COLUMN "lighthouseBP" SET DATA TYPE DOUBLE PRECISION;
|
|
276
|
+
|
|
277
|
+
-- AlterTable
|
|
278
|
+
ALTER TABLE "PlatformJob" DROP COLUMN IF EXISTS "appiumSessionId",
|
|
279
|
+
DROP COLUMN IF EXISTS "deviceFarm",
|
|
280
|
+
DROP COLUMN IF EXISTS "deviceModel",
|
|
281
|
+
DROP COLUMN IF EXISTS "osVersion";
|
|
282
|
+
|
|
283
|
+
-- AlterTable
|
|
284
|
+
ALTER TABLE "Project" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
285
|
+
|
|
286
|
+
-- AlterTable
|
|
287
|
+
ALTER TABLE "ProjectArtifact" ALTER COLUMN "keywords" DROP DEFAULT;
|
|
288
|
+
|
|
289
|
+
-- AlterTable
|
|
290
|
+
ALTER TABLE "Requirement" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
291
|
+
|
|
292
|
+
-- AlterTable
|
|
293
|
+
ALTER TABLE "Scenario" ALTER COLUMN "gherkin" DROP DEFAULT;
|
|
294
|
+
|
|
295
|
+
-- AlterTable
|
|
296
|
+
ALTER TABLE "Screen" DROP COLUMN IF EXISTS "a11yViolations",
|
|
297
|
+
DROP COLUMN IF EXISTS "securityHeaders";
|
|
298
|
+
|
|
299
|
+
-- AlterTable
|
|
300
|
+
ALTER TABLE "ScreenGroup" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
301
|
+
|
|
302
|
+
-- AlterTable
|
|
303
|
+
ALTER TABLE "SharedRunToken" ALTER COLUMN "expiresAt" SET DATA TYPE TIMESTAMP(3),
|
|
304
|
+
ALTER COLUMN "createdAt" SET DATA TYPE TIMESTAMP(3);
|
|
305
|
+
|
|
306
|
+
-- AlterTable
|
|
307
|
+
ALTER TABLE "SlackConnection" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
308
|
+
|
|
309
|
+
-- AlterTable
|
|
310
|
+
ALTER TABLE "SsoConfig" ALTER COLUMN "jitProvisioning" SET DEFAULT false,
|
|
311
|
+
ALTER COLUMN "updatedAt" DROP DEFAULT,
|
|
312
|
+
ALTER COLUMN "emailDomains" DROP DEFAULT;
|
|
313
|
+
|
|
314
|
+
-- AlterTable
|
|
315
|
+
ALTER TABLE "StepEvidence" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
316
|
+
|
|
317
|
+
-- AlterTable
|
|
318
|
+
ALTER TABLE "TeamsConnection" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
319
|
+
|
|
320
|
+
-- AlterTable
|
|
321
|
+
ALTER TABLE "Tenant" ALTER COLUMN "isolation" DROP DEFAULT,
|
|
322
|
+
ALTER COLUMN "region" DROP DEFAULT;
|
|
323
|
+
|
|
324
|
+
-- AlterTable
|
|
325
|
+
ALTER TABLE "TenantPlan" ALTER COLUMN "maxProjects" DROP DEFAULT,
|
|
326
|
+
ALTER COLUMN "maxMembers" DROP DEFAULT,
|
|
327
|
+
ALTER COLUMN "maxCrawlsPerMonth" DROP DEFAULT,
|
|
328
|
+
ALTER COLUMN "maxRunsPerMonth" DROP DEFAULT,
|
|
329
|
+
ALTER COLUMN "maxShards" DROP DEFAULT,
|
|
330
|
+
ALTER COLUMN "maxTokensPerMonth" DROP DEFAULT,
|
|
331
|
+
ALTER COLUMN "updatedAt" DROP DEFAULT,
|
|
332
|
+
ALTER COLUMN "maxSessions" DROP DEFAULT;
|
|
333
|
+
|
|
334
|
+
-- AlterTable
|
|
335
|
+
ALTER TABLE "TenantPlanConfig" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
336
|
+
|
|
337
|
+
-- AlterTable
|
|
338
|
+
ALTER TABLE "TestCase" DROP COLUMN IF EXISTS "genAt";
|
|
339
|
+
ALTER TABLE "TestCase" ADD COLUMN IF NOT EXISTS "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
|
340
|
+
ALTER TABLE "TestCase" ADD COLUMN IF NOT EXISTS "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
|
341
|
+
|
|
342
|
+
-- AlterTable
|
|
343
|
+
ALTER TABLE "TestResult" DROP COLUMN IF EXISTS "dataRow",
|
|
344
|
+
DROP COLUMN IF EXISTS "networkTimings",
|
|
345
|
+
DROP COLUMN IF EXISTS "rootCauseSummary";
|
|
346
|
+
|
|
347
|
+
-- AlterTable
|
|
348
|
+
ALTER TABLE "VisualBaseline" DROP COLUMN IF EXISTS "domSnapshotPath";
|
|
349
|
+
|
|
350
|
+
-- CreateTable
|
|
351
|
+
CREATE TABLE IF NOT EXISTS "role_configs" (
|
|
352
|
+
"roleName" TEXT NOT NULL,
|
|
353
|
+
"rank" INTEGER NOT NULL,
|
|
354
|
+
"permissions" TEXT[],
|
|
355
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
356
|
+
|
|
357
|
+
CONSTRAINT "role_configs_pkey" PRIMARY KEY ("roleName")
|
|
358
|
+
);
|
|
359
|
+
|
|
360
|
+
-- CreateTable
|
|
361
|
+
CREATE TABLE IF NOT EXISTS "LlmPricing" (
|
|
362
|
+
"id" TEXT NOT NULL,
|
|
363
|
+
"modelKey" TEXT NOT NULL,
|
|
364
|
+
"inputPer1M" DOUBLE PRECISION NOT NULL,
|
|
365
|
+
"outputPer1M" DOUBLE PRECISION NOT NULL,
|
|
366
|
+
"cacheReadPer1M" DOUBLE PRECISION NOT NULL DEFAULT 0,
|
|
367
|
+
"cacheWritePer1M" DOUBLE PRECISION NOT NULL DEFAULT 0,
|
|
368
|
+
"effectiveDate" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
369
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
370
|
+
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
371
|
+
|
|
372
|
+
CONSTRAINT "LlmPricing_pkey" PRIMARY KEY ("id")
|
|
373
|
+
);
|
|
374
|
+
|
|
375
|
+
-- CreateIndex
|
|
376
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "role_configs_rank_key" ON "role_configs"("rank");
|
|
377
|
+
|
|
378
|
+
-- CreateIndex
|
|
379
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "LlmPricing_modelKey_key" ON "LlmPricing"("modelKey");
|
|
380
|
+
|
|
381
|
+
-- CreateIndex
|
|
382
|
+
CREATE INDEX IF NOT EXISTS "LlmPricing_modelKey_idx" ON "LlmPricing"("modelKey");
|
|
383
|
+
|
|
384
|
+
-- CreateIndex
|
|
385
|
+
CREATE INDEX IF NOT EXISTS "AuditLog_tenantId_action_idx" ON "AuditLog"("tenantId", "action");
|
|
386
|
+
|
|
387
|
+
-- CreateIndex
|
|
388
|
+
CREATE INDEX IF NOT EXISTS "Membership_tenantId_idx" ON "Membership"("tenantId");
|
|
389
|
+
|
|
390
|
+
-- CreateIndex
|
|
391
|
+
CREATE INDEX IF NOT EXISTS "Membership_userId_idx" ON "Membership"("userId");
|
|
392
|
+
|
|
393
|
+
-- CreateIndex
|
|
394
|
+
CREATE INDEX IF NOT EXISTS "MfaRecoveryCode_userId_idx" ON "MfaRecoveryCode"("userId");
|
|
395
|
+
|
|
396
|
+
-- CreateIndex
|
|
397
|
+
CREATE INDEX IF NOT EXISTS "PlatformJob_tenantId_projectId_queuedAt_idx" ON "PlatformJob"("tenantId", "projectId", "queuedAt");
|
|
398
|
+
|
|
399
|
+
-- CreateIndex
|
|
400
|
+
CREATE INDEX IF NOT EXISTS "PlatformJob_status_workerId_idx" ON "PlatformJob"("status", "workerId");
|
|
401
|
+
|
|
402
|
+
-- CreateIndex
|
|
403
|
+
CREATE INDEX IF NOT EXISTS "Screen_status_idx" ON "Screen"("status");
|
|
404
|
+
|
|
405
|
+
-- CreateIndex
|
|
406
|
+
CREATE INDEX IF NOT EXISTS "TestCase_status_projectId_idx" ON "TestCase"("status", "projectId");
|
|
407
|
+
|
|
408
|
+
-- CreateIndex
|
|
409
|
+
CREATE INDEX IF NOT EXISTS "TestCaseRun_tenantId_status_createdAt_idx" ON "TestCaseRun"("tenantId", "status", "createdAt");
|
|
410
|
+
|
|
411
|
+
-- CreateIndex
|
|
412
|
+
CREATE INDEX IF NOT EXISTS "TestResult_tenantId_runId_status_idx" ON "TestResult"("tenantId", "runId", "status");
|
|
413
|
+
|
|
414
|
+
-- CreateIndex
|
|
415
|
+
CREATE INDEX IF NOT EXISTS "WebhookDelivery_webhookId_status_idx" ON "WebhookDelivery"("webhookId", "status");
|
|
416
|
+
|
|
417
|
+
-- AddForeignKey
|
|
418
|
+
DO $$ BEGIN
|
|
419
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'Screen_projectId_fkey') THEN
|
|
420
|
+
ALTER TABLE "Screen" ADD CONSTRAINT "Screen_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
421
|
+
END IF;
|
|
422
|
+
END $$;
|
|
423
|
+
|
|
424
|
+
-- AddForeignKey
|
|
425
|
+
DO $$ BEGIN
|
|
426
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ScreenA11yViolation_projectId_fkey') THEN
|
|
427
|
+
ALTER TABLE "ScreenA11yViolation" ADD CONSTRAINT "ScreenA11yViolation_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
428
|
+
END IF;
|
|
429
|
+
END $$;
|
|
430
|
+
|
|
431
|
+
-- AddForeignKey
|
|
432
|
+
DO $$ BEGIN
|
|
433
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ScreenA11yViolation_screenId_fkey') THEN
|
|
434
|
+
ALTER TABLE "ScreenA11yViolation" ADD CONSTRAINT "ScreenA11yViolation_screenId_fkey" FOREIGN KEY ("screenId") REFERENCES "Screen"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
435
|
+
END IF;
|
|
436
|
+
END $$;
|
|
437
|
+
|
|
438
|
+
-- AddForeignKey
|
|
439
|
+
DO $$ BEGIN
|
|
440
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'Element_screenId_fkey') THEN
|
|
441
|
+
ALTER TABLE "Element" ADD CONSTRAINT "Element_screenId_fkey" FOREIGN KEY ("screenId") REFERENCES "Screen"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
442
|
+
END IF;
|
|
443
|
+
END $$;
|
|
444
|
+
|
|
445
|
+
-- AddForeignKey
|
|
446
|
+
DO $$ BEGIN
|
|
447
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestSuite_projectId_fkey') THEN
|
|
448
|
+
ALTER TABLE "TestSuite" ADD CONSTRAINT "TestSuite_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
449
|
+
END IF;
|
|
450
|
+
END $$;
|
|
451
|
+
|
|
452
|
+
-- AddForeignKey
|
|
453
|
+
DO $$ BEGIN
|
|
454
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestCase_dataSetId_fkey') THEN
|
|
455
|
+
ALTER TABLE "TestCase" ADD CONSTRAINT "TestCase_dataSetId_fkey" FOREIGN KEY ("dataSetId") REFERENCES "TestDataSet"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
456
|
+
END IF;
|
|
457
|
+
END $$;
|
|
458
|
+
|
|
459
|
+
-- AddForeignKey
|
|
460
|
+
DO $$ BEGIN
|
|
461
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestRunShard_runId_fkey') THEN
|
|
462
|
+
ALTER TABLE "TestRunShard" ADD CONSTRAINT "TestRunShard_runId_fkey" FOREIGN KEY ("runId") REFERENCES "TestRun"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
463
|
+
END IF;
|
|
464
|
+
END $$;
|
|
465
|
+
|
|
466
|
+
-- AddForeignKey
|
|
467
|
+
DO $$ BEGIN
|
|
468
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'SsoConfig_tenantId_fkey') THEN
|
|
469
|
+
ALTER TABLE "SsoConfig" ADD CONSTRAINT "SsoConfig_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
470
|
+
END IF;
|
|
471
|
+
END $$;
|
|
472
|
+
|
|
473
|
+
-- AddForeignKey
|
|
474
|
+
DO $$ BEGIN
|
|
475
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'AuditLog_actorId_fkey') THEN
|
|
476
|
+
ALTER TABLE "AuditLog" ADD CONSTRAINT "AuditLog_actorId_fkey" FOREIGN KEY ("actorId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
477
|
+
END IF;
|
|
478
|
+
END $$;
|
|
479
|
+
|
|
480
|
+
-- AddForeignKey
|
|
481
|
+
DO $$ BEGIN
|
|
482
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'AuditLog_tenantId_fkey') THEN
|
|
483
|
+
ALTER TABLE "AuditLog" ADD CONSTRAINT "AuditLog_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
484
|
+
END IF;
|
|
485
|
+
END $$;
|
|
486
|
+
|
|
487
|
+
-- AddForeignKey
|
|
488
|
+
DO $$ BEGIN
|
|
489
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'AccessReview_tenantId_fkey') THEN
|
|
490
|
+
ALTER TABLE "AccessReview" ADD CONSTRAINT "AccessReview_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
491
|
+
END IF;
|
|
492
|
+
END $$;
|
|
493
|
+
|
|
494
|
+
-- AddForeignKey
|
|
495
|
+
DO $$ BEGIN
|
|
496
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ScreenDiff_screenId_fkey') THEN
|
|
497
|
+
ALTER TABLE "ScreenDiff" ADD CONSTRAINT "ScreenDiff_screenId_fkey" FOREIGN KEY ("screenId") REFERENCES "Screen"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
498
|
+
END IF;
|
|
499
|
+
END $$;
|
|
500
|
+
|
|
501
|
+
-- AddForeignKey
|
|
502
|
+
DO $$ BEGIN
|
|
503
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ProbeObservation_screenId_fkey') THEN
|
|
504
|
+
ALTER TABLE "ProbeObservation" ADD CONSTRAINT "ProbeObservation_screenId_fkey" FOREIGN KEY ("screenId") REFERENCES "Screen"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
505
|
+
END IF;
|
|
506
|
+
END $$;
|
|
507
|
+
|
|
508
|
+
-- AddForeignKey
|
|
509
|
+
DO $$ BEGIN
|
|
510
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'Notification_tenantId_fkey') THEN
|
|
511
|
+
ALTER TABLE "Notification" ADD CONSTRAINT "Notification_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
512
|
+
END IF;
|
|
513
|
+
END $$;
|
|
514
|
+
|
|
515
|
+
-- AddForeignKey
|
|
516
|
+
DO $$ BEGIN
|
|
517
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'Notification_userId_fkey') THEN
|
|
518
|
+
ALTER TABLE "Notification" ADD CONSTRAINT "Notification_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
519
|
+
END IF;
|
|
520
|
+
END $$;
|
|
521
|
+
|
|
522
|
+
-- AddForeignKey
|
|
523
|
+
DO $$ BEGIN
|
|
524
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'NotificationPreference_tenantId_fkey') THEN
|
|
525
|
+
ALTER TABLE "NotificationPreference" ADD CONSTRAINT "NotificationPreference_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
526
|
+
END IF;
|
|
527
|
+
END $$;
|
|
528
|
+
|
|
529
|
+
-- AddForeignKey
|
|
530
|
+
DO $$ BEGIN
|
|
531
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'NotificationPreference_userId_fkey') THEN
|
|
532
|
+
ALTER TABLE "NotificationPreference" ADD CONSTRAINT "NotificationPreference_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
533
|
+
END IF;
|
|
534
|
+
END $$;
|
|
535
|
+
|
|
536
|
+
-- AddForeignKey
|
|
537
|
+
DO $$ BEGIN
|
|
538
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'ProjectEnvironment_projectId_fkey') THEN
|
|
539
|
+
ALTER TABLE "ProjectEnvironment" ADD CONSTRAINT "ProjectEnvironment_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
540
|
+
END IF;
|
|
541
|
+
END $$;
|
|
542
|
+
|
|
543
|
+
-- AddForeignKey
|
|
544
|
+
DO $$ BEGIN
|
|
545
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'Comment_userId_fkey') THEN
|
|
546
|
+
ALTER TABLE "Comment" ADD CONSTRAINT "Comment_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
547
|
+
END IF;
|
|
548
|
+
END $$;
|
|
549
|
+
|
|
550
|
+
-- AddForeignKey
|
|
551
|
+
DO $$ BEGIN
|
|
552
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TenantPlan_tenantId_fkey') THEN
|
|
553
|
+
ALTER TABLE "TenantPlan" ADD CONSTRAINT "TenantPlan_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
554
|
+
END IF;
|
|
555
|
+
END $$;
|
|
556
|
+
|
|
557
|
+
-- AddForeignKey
|
|
558
|
+
DO $$ BEGIN
|
|
559
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'SlackConnection_tenantId_fkey') THEN
|
|
560
|
+
ALTER TABLE "SlackConnection" ADD CONSTRAINT "SlackConnection_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
561
|
+
END IF;
|
|
562
|
+
END $$;
|
|
563
|
+
|
|
564
|
+
-- AddForeignKey
|
|
565
|
+
DO $$ BEGIN
|
|
566
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TeamsConnection_tenantId_fkey') THEN
|
|
567
|
+
ALTER TABLE "TeamsConnection" ADD CONSTRAINT "TeamsConnection_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
568
|
+
END IF;
|
|
569
|
+
END $$;
|
|
570
|
+
|
|
571
|
+
-- AddForeignKey
|
|
572
|
+
DO $$ BEGIN
|
|
573
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TenantSiloConfig_tenantId_fkey') THEN
|
|
574
|
+
ALTER TABLE "TenantSiloConfig" ADD CONSTRAINT "TenantSiloConfig_tenantId_fkey" FOREIGN KEY ("tenantId") REFERENCES "Tenant"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
575
|
+
END IF;
|
|
576
|
+
END $$;
|
|
577
|
+
|
|
578
|
+
-- AddForeignKey
|
|
579
|
+
DO $$ BEGIN
|
|
580
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestDataSet_projectId_fkey') THEN
|
|
581
|
+
ALTER TABLE "TestDataSet" ADD CONSTRAINT "TestDataSet_projectId_fkey" FOREIGN KEY ("projectId") REFERENCES "Project"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
582
|
+
END IF;
|
|
583
|
+
END $$;
|
|
584
|
+
|
|
585
|
+
-- AddForeignKey
|
|
586
|
+
DO $$ BEGIN
|
|
587
|
+
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'TestDataRow_dataSetId_fkey') THEN
|
|
588
|
+
ALTER TABLE "TestDataRow" ADD CONSTRAINT "TestDataRow_dataSetId_fkey" FOREIGN KEY ("dataSetId") REFERENCES "TestDataSet"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
589
|
+
END IF;
|
|
590
|
+
END $$;
|
|
591
|
+
|
|
592
|
+
-- RenameIndex
|
|
593
|
+
DO $$ BEGIN
|
|
594
|
+
IF EXISTS (SELECT 1 FROM pg_indexes WHERE indexname = 'Element_ext_upsert_key')
|
|
595
|
+
AND NOT EXISTS (SELECT 1 FROM pg_indexes WHERE indexname = 'Element_tenantId_projectId_selector_pageUrl_key') THEN
|
|
596
|
+
ALTER INDEX "Element_ext_upsert_key" RENAME TO "Element_tenantId_projectId_selector_pageUrl_key";
|
|
597
|
+
END IF;
|
|
598
|
+
END $$;
|
|
599
|
+
|
|
600
|
+
-- RenameIndex
|
|
601
|
+
DO $$ BEGIN
|
|
602
|
+
IF EXISTS (SELECT 1 FROM pg_indexes WHERE indexname = 'WorkspaceAgentPromptHistory_workspaceAgentPromptId_changedAt_id')
|
|
603
|
+
AND NOT EXISTS (SELECT 1 FROM pg_indexes WHERE indexname = 'WorkspaceAgentPromptHistory_workspaceAgentPromptId_changedA_idx') THEN
|
|
604
|
+
ALTER INDEX "WorkspaceAgentPromptHistory_workspaceAgentPromptId_changedAt_id" RENAME TO "WorkspaceAgentPromptHistory_workspaceAgentPromptId_changedA_idx";
|
|
605
|
+
END IF;
|
|
606
|
+
END $$;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- Corrective migration: add createdAt/updatedAt to TestCase if missing.
|
|
2
|
+
-- The previous migration (20260904180424) failed on non-empty tables because
|
|
3
|
+
-- updatedAt was added as NOT NULL without a DEFAULT. Both columns use
|
|
4
|
+
-- DEFAULT CURRENT_TIMESTAMP here so existing rows get a safe initial value.
|
|
5
|
+
-- genAt is dropped if it still exists (idempotent with IF EXISTS).
|
|
6
|
+
|
|
7
|
+
ALTER TABLE "TestCase"
|
|
8
|
+
DROP COLUMN IF EXISTS "genAt",
|
|
9
|
+
ADD COLUMN IF NOT EXISTS "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
10
|
+
ADD COLUMN IF NOT EXISTS "updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
|
11
|
+
|
|
12
|
+
-- Create the status+projectId index if missing (also from that migration).
|
|
13
|
+
CREATE INDEX IF NOT EXISTS "TestCase_status_projectId_idx" ON "TestCase"("status", "projectId");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "ProjectArtifact" ADD COLUMN IF NOT EXISTS "importedSuiteId" TEXT;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- Add login tracking fields to User table.
|
|
2
|
+
-- lastLoginAt: updated on successful login
|
|
3
|
+
-- failedLoginCount: consecutive failures since last success, reset on login
|
|
4
|
+
-- lastFailedLoginAt: timestamp of most recent failed attempt
|
|
5
|
+
|
|
6
|
+
ALTER TABLE "User"
|
|
7
|
+
ADD COLUMN IF NOT EXISTS "lastLoginAt" TIMESTAMP(3),
|
|
8
|
+
ADD COLUMN IF NOT EXISTS "failedLoginCount" INTEGER NOT NULL DEFAULT 0,
|
|
9
|
+
ADD COLUMN IF NOT EXISTS "lastFailedLoginAt" TIMESTAMP(3);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- Add import tracking fields to ProjectArtifact table.
|
|
2
|
+
-- importStatus: null | 'IMPORTED' | 'FAILED'
|
|
3
|
+
-- importedAt: timestamp when test cases were imported
|
|
4
|
+
-- importedTestCount: number of test cases imported from this artifact
|
|
5
|
+
|
|
6
|
+
ALTER TABLE "ProjectArtifact"
|
|
7
|
+
ADD COLUMN IF NOT EXISTS "importStatus" TEXT,
|
|
8
|
+
ADD COLUMN IF NOT EXISTS "importedAt" TIMESTAMP(3),
|
|
9
|
+
ADD COLUMN IF NOT EXISTS "importedTestCount" INTEGER;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
-- Add version chain columns to ProjectArtifact.
|
|
2
|
+
-- versionNum: increments on re-upload, defaults to 1 for all existing rows
|
|
3
|
+
-- previousVersionId: self-referential FK linking to prior artifact version
|
|
4
|
+
|
|
5
|
+
ALTER TABLE "ProjectArtifact"
|
|
6
|
+
ADD COLUMN IF NOT EXISTS "versionNum" INTEGER NOT NULL DEFAULT 1,
|
|
7
|
+
ADD COLUMN IF NOT EXISTS "previousVersionId" TEXT;
|
|
8
|
+
|
|
9
|
+
DO $$ BEGIN
|
|
10
|
+
IF NOT EXISTS (
|
|
11
|
+
SELECT 1 FROM pg_constraint WHERE conname = 'ProjectArtifact_previousVersionId_fkey'
|
|
12
|
+
) THEN
|
|
13
|
+
ALTER TABLE "ProjectArtifact"
|
|
14
|
+
ADD CONSTRAINT "ProjectArtifact_previousVersionId_fkey"
|
|
15
|
+
FOREIGN KEY ("previousVersionId")
|
|
16
|
+
REFERENCES "ProjectArtifact"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
17
|
+
END IF;
|
|
18
|
+
END $$;
|