@trycompai/db 1.0.0
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/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +39 -0
- package/dist/index.mjs +14 -0
- package/dist/prisma/functionDefinition.sql +18 -0
- package/dist/prisma/migrations/20250403163138_init/migration.sql +611 -0
- package/dist/prisma/migrations/20250403165218_archived_on_its_own/migration.sql +29 -0
- package/dist/prisma/migrations/20250403194504_risk_assignee/migration.sql +18 -0
- package/dist/prisma/migrations/20250403201319_tasks_use_asignee/migration.sql +16 -0
- package/dist/prisma/migrations/20250403205655_vendor_assignee/migration.sql +22 -0
- package/dist/prisma/migrations/20250403205840_oops_optional/migration.sql +2 -0
- package/dist/prisma/migrations/20250403210049_task_assignee_optional_too/migration.sql +8 -0
- package/dist/prisma/migrations/20250404004853_stripecustomerid/migration.sql +2 -0
- package/dist/prisma/migrations/20250406004306_added_common_comment_table/migration.sql +20 -0
- package/dist/prisma/migrations/20250410193847_add_unique_constraint_to_artifact_t_table/migration.sql +30 -0
- package/dist/prisma/migrations/20250410193857_remove_published_field_from_evidence/migration.sql +12 -0
- package/dist/prisma/migrations/20250414191353_onboarding_experience/migration.sql +25 -0
- package/dist/prisma/migrations/20250414203443_added_evidence_to_onboarding/migration.sql +2 -0
- package/dist/prisma/migrations/20250417205622_add_global_vendors/migration.sql +26 -0
- package/dist/prisma/migrations/20250417205625_update_task_table_and_comments_and_attachments/migration.sql +86 -0
- package/dist/prisma/migrations/20250417205627_remove_evidence_table/migration.sql +109 -0
- package/dist/prisma/migrations/20250417205629_frequency_task_is_optional/migration.sql +2 -0
- package/dist/prisma/migrations/20250418151856_add_comment_relationship_to_attachment_and_vice_versa/migration.sql +8 -0
- package/dist/prisma/migrations/20250423154259_make_role_string/migration.sql +9 -0
- package/dist/prisma/migrations/20250424165055_update_onboarding_to_use_tasks/migration.sql +9 -0
- package/dist/prisma/migrations/20250424170518_remove_evidence_artifact_type/migration.sql +14 -0
- package/dist/prisma/migrations/20250428202144_add_website_to_organization/migration.sql +2 -0
- package/dist/prisma/migrations/20250429155419_add_company_details_to_onboarding/migration.sql +2 -0
- package/dist/prisma/migrations/20250509160401_added_framework_editor/migration.sql +8 -0
- package/dist/prisma/migrations/20250509162708_init_framework_editor_tables/migration.sql +122 -0
- package/dist/prisma/migrations/20250509172401_drop_slug/migration.sql +11 -0
- package/dist/prisma/migrations/20250509232122_trust_portal/migration.sql +24 -0
- package/dist/prisma/migrations/20250511040043_add_custom_domain_to_trust_portal/migration.sql +2 -0
- package/dist/prisma/migrations/20250511042943_trust_portal_domain_verified/migration.sql +2 -0
- package/dist/prisma/migrations/20250512004633_added_identifier/migration.sql +5 -0
- package/dist/prisma/migrations/20250512115717_added_framework_status/migration.sql +7 -0
- package/dist/prisma/migrations/20250512163351_add_contact_details_trust_portal/migration.sql +2 -0
- package/dist/prisma/migrations/20250514143147_remove_unique_constraint_on_integration_name/migration.sql +2 -0
- package/dist/prisma/migrations/20250514144228_add_vercel_check/migration.sql +2 -0
- package/dist/prisma/migrations/20250514150021_add_vercel_verification/migration.sql +2 -0
- package/dist/prisma/migrations/20250514161440_add_dates_to_framework_editor_tables/migration.sql +23 -0
- package/dist/prisma/migrations/20250515123635_trust_portal_friendly_url/migration.sql +21 -0
- package/dist/prisma/migrations/20250515124040_fix_trust_constraints/migration.sql +11 -0
- package/dist/prisma/migrations/20250516125758_patch_framework_id_in_editor/migration.sql +6 -0
- package/dist/prisma/migrations/20250516132431_add_many_to_many_support_to_tasks/migration.sql +69 -0
- package/dist/prisma/migrations/20250516142234_make_entity_optional/migration.sql +3 -0
- package/dist/prisma/migrations/20250516145149_drop_entity_and_entity_type/migration.sql +16 -0
- package/dist/prisma/migrations/20250516150558_drop_task_type/migration.sql +2 -0
- package/dist/prisma/migrations/20250516160714_insert_hardcoded_framework_to_db/migration.sql +37 -0
- package/dist/prisma/migrations/20250516161852_cast_framework_id_and_requirement_id_to_string/migration.sql +5 -0
- package/dist/prisma/migrations/20250516162324_convert_ids_to_new_format/migration.sql +31 -0
- package/dist/prisma/migrations/20250516162730_convert_framework_id/migration.sql +5 -0
- package/dist/prisma/migrations/20250516163156_added_relation_to_framework_and_requirement_maps/migration.sql +5 -0
- package/dist/prisma/migrations/20250516164307_drop_enums/migration.sql +5 -0
- package/dist/prisma/migrations/20250516194123_add_cal_option/migration.sql +2 -0
- package/dist/prisma/migrations/20250518133218_add_booking_details/migration.sql +2 -0
- package/dist/prisma/migrations/20250519141733_change_framework_id_to_string/migration.sql +3 -0
- package/dist/prisma/migrations/20250519141735_drop_enum_on_requirements_map/migration.sql +2 -0
- package/dist/prisma/migrations/20250519142913_add_template_references_to_instances/migration.sql +17 -0
- package/dist/prisma/migrations/20250519172353_drop_artifacts/migration.sql +56 -0
- package/dist/prisma/migrations/20250519204449_drop_relation_between_controls_and_framewrok_instance/migration.sql +14 -0
- package/dist/prisma/migrations/20250519212347_add_visibility_toggle_to_framework_editor/migration.sql +2 -0
- package/dist/prisma/migrations/20250520152548_add_approver_to_policy/migration.sql +5 -0
- package/dist/prisma/migrations/20250520175109_add_description_to_audit_log_for_convenience/migration.sql +2 -0
- package/dist/prisma/migrations/20250520175523_add_member_id_to_log_table/migration.sql +8 -0
- package/dist/prisma/migrations/20250521140239_add_entity_type_and_id_for_audit_logs_for_easy_filtering/migration.sql +9 -0
- package/dist/prisma/migrations/20250603135046_add_v2_onboarding_requirements/migration.sql +36 -0
- package/dist/prisma/migrations/20250604155610_add_job_id_column_to_onboarding/migration.sql +2 -0
- package/dist/prisma/migrations/20250605151521_make_framework_visibility_false/migration.sql +2 -0
- package/dist/prisma/migrations/20250605184738_add_cascade_to_entities_owned_by_org/migration.sql +29 -0
- package/dist/prisma/migrations/20250605184740_add_device_agent_details_to_org/migration.sql +18 -0
- package/dist/prisma/migrations/20250609130129_add_not_relevant/migration.sql +2 -0
- package/dist/prisma/migrations/20250610215328_add_fleet_label_to_employees/migration.sql +2 -0
- package/dist/prisma/migrations/20250611144654_add_is_fleet_setup_flag/migration.sql +2 -0
- package/dist/prisma/migrations/20250612160731_remove_unused_cols/migration.sql +10 -0
- package/dist/prisma/migrations/20250618001304_add_default_slug/migration.sql +3 -0
- package/dist/prisma/migrations/20250623184529_add_subscription_type/migration.sql +12 -0
- package/dist/prisma/migrations/20250626021946_add_starter_subscription_type/migration.sql +27 -0
- package/dist/prisma/migrations/20250626030206_added_new_subscription_type/migration.sql +2 -0
- package/dist/prisma/migrations/20250627180331_add_onboaridng_field/migration.sql +5 -0
- package/dist/prisma/migrations/20250627180828_rename_completed_col/migration.sql +15 -0
- package/dist/prisma/migrations/20250708152414_add_had_call_col/migration.sql +2 -0
- package/dist/prisma/migrations/20250711201749_update_retool_role_to_edit_had_call_column_in_organization_table/migration.sql +7 -0
- package/dist/prisma/migrations/20250711204234_add_read_permission_for_where_clause_on_retool_role/migration.sql +8 -0
- package/dist/prisma/migrations/20250714153009_remove_stripe_and_add_has_access/migration.sql +31 -0
- package/dist/prisma/migrations/20250715200054_add_perms_for_has_access_for_retool/migration.sql +7 -0
- package/dist/prisma/migrations/migration_lock.toml +3 -0
- package/dist/prisma/randomSecret.sql +12 -0
- package/dist/prisma/schema/attachments.prisma +35 -0
- package/dist/prisma/schema/auth.prisma +122 -0
- package/dist/prisma/schema/comment.prisma +27 -0
- package/dist/prisma/schema/context.prisma +18 -0
- package/dist/prisma/schema/control.prisma +21 -0
- package/dist/prisma/schema/framework-editor.prisma +96 -0
- package/dist/prisma/schema/framework.prisma +14 -0
- package/dist/prisma/schema/integration.prisma +32 -0
- package/dist/prisma/schema/onboarding.prisma +18 -0
- package/dist/prisma/schema/organization.prisma +34 -0
- package/dist/prisma/schema/policy.prisma +32 -0
- package/dist/prisma/schema/requirement.prisma +15 -0
- package/dist/prisma/schema/risk.prisma +57 -0
- package/dist/prisma/schema/shared.prisma +104 -0
- package/dist/prisma/schema/task.prisma +41 -0
- package/dist/prisma/schema/trust.prisma +37 -0
- package/dist/prisma/schema/vendor.prisma +56 -0
- package/dist/prisma/schema.prisma +12 -0
- package/dist/prisma/seed/frameworkEditorSchemas.js +136 -0
- package/dist/prisma/seed/frameworkEditorSchemas.ts +178 -0
- package/dist/prisma/seed/primitives/FrameworkEditorControlTemplate.json +296 -0
- package/dist/prisma/seed/primitives/FrameworkEditorFramework.json +101 -0
- package/dist/prisma/seed/primitives/FrameworkEditorPolicyTemplate.json +6057 -0
- package/dist/prisma/seed/primitives/FrameworkEditorRequirement.json +7841 -0
- package/dist/prisma/seed/primitives/FrameworkEditorTaskTemplate.json +308 -0
- package/dist/prisma/seed/primitives/FrameworkEditorVideo.json +47 -0
- package/dist/prisma/seed/relations/_FrameworkEditorControlTemplateToFrameworkEditorPolicyTemplate.json +178 -0
- package/dist/prisma/seed/relations/_FrameworkEditorControlTemplateToFrameworkEditorRequirement.json +470 -0
- package/dist/prisma/seed/relations/_FrameworkEditorControlTemplateToFrameworkEditorTaskTemplate.json +142 -0
- package/dist/prisma/seed/seed.js +160 -0
- package/dist/prisma/seed/seed.ts +192 -0
- package/dist/types.d.mts +1 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +24 -0
- package/dist/types.mjs +2 -0
- package/package.json +75 -0
- package/prisma/functionDefinition.sql +18 -0
- package/prisma/migrations/20250403163138_init/migration.sql +611 -0
- package/prisma/migrations/20250403165218_archived_on_its_own/migration.sql +29 -0
- package/prisma/migrations/20250403194504_risk_assignee/migration.sql +18 -0
- package/prisma/migrations/20250403201319_tasks_use_asignee/migration.sql +16 -0
- package/prisma/migrations/20250403205655_vendor_assignee/migration.sql +22 -0
- package/prisma/migrations/20250403205840_oops_optional/migration.sql +2 -0
- package/prisma/migrations/20250403210049_task_assignee_optional_too/migration.sql +8 -0
- package/prisma/migrations/20250404004853_stripecustomerid/migration.sql +2 -0
- package/prisma/migrations/20250406004306_added_common_comment_table/migration.sql +20 -0
- package/prisma/migrations/20250410193847_add_unique_constraint_to_artifact_t_table/migration.sql +30 -0
- package/prisma/migrations/20250410193857_remove_published_field_from_evidence/migration.sql +12 -0
- package/prisma/migrations/20250414191353_onboarding_experience/migration.sql +25 -0
- package/prisma/migrations/20250414203443_added_evidence_to_onboarding/migration.sql +2 -0
- package/prisma/migrations/20250417205622_add_global_vendors/migration.sql +26 -0
- package/prisma/migrations/20250417205625_update_task_table_and_comments_and_attachments/migration.sql +86 -0
- package/prisma/migrations/20250417205627_remove_evidence_table/migration.sql +109 -0
- package/prisma/migrations/20250417205629_frequency_task_is_optional/migration.sql +2 -0
- package/prisma/migrations/20250418151856_add_comment_relationship_to_attachment_and_vice_versa/migration.sql +8 -0
- package/prisma/migrations/20250423154259_make_role_string/migration.sql +9 -0
- package/prisma/migrations/20250424165055_update_onboarding_to_use_tasks/migration.sql +9 -0
- package/prisma/migrations/20250424170518_remove_evidence_artifact_type/migration.sql +14 -0
- package/prisma/migrations/20250428202144_add_website_to_organization/migration.sql +2 -0
- package/prisma/migrations/20250429155419_add_company_details_to_onboarding/migration.sql +2 -0
- package/prisma/migrations/20250509160401_added_framework_editor/migration.sql +8 -0
- package/prisma/migrations/20250509162708_init_framework_editor_tables/migration.sql +122 -0
- package/prisma/migrations/20250509172401_drop_slug/migration.sql +11 -0
- package/prisma/migrations/20250509232122_trust_portal/migration.sql +24 -0
- package/prisma/migrations/20250511040043_add_custom_domain_to_trust_portal/migration.sql +2 -0
- package/prisma/migrations/20250511042943_trust_portal_domain_verified/migration.sql +2 -0
- package/prisma/migrations/20250512004633_added_identifier/migration.sql +5 -0
- package/prisma/migrations/20250512115717_added_framework_status/migration.sql +7 -0
- package/prisma/migrations/20250512163351_add_contact_details_trust_portal/migration.sql +2 -0
- package/prisma/migrations/20250514143147_remove_unique_constraint_on_integration_name/migration.sql +2 -0
- package/prisma/migrations/20250514144228_add_vercel_check/migration.sql +2 -0
- package/prisma/migrations/20250514150021_add_vercel_verification/migration.sql +2 -0
- package/prisma/migrations/20250514161440_add_dates_to_framework_editor_tables/migration.sql +23 -0
- package/prisma/migrations/20250515123635_trust_portal_friendly_url/migration.sql +21 -0
- package/prisma/migrations/20250515124040_fix_trust_constraints/migration.sql +11 -0
- package/prisma/migrations/20250516125758_patch_framework_id_in_editor/migration.sql +6 -0
- package/prisma/migrations/20250516132431_add_many_to_many_support_to_tasks/migration.sql +69 -0
- package/prisma/migrations/20250516142234_make_entity_optional/migration.sql +3 -0
- package/prisma/migrations/20250516145149_drop_entity_and_entity_type/migration.sql +16 -0
- package/prisma/migrations/20250516150558_drop_task_type/migration.sql +2 -0
- package/prisma/migrations/20250516160714_insert_hardcoded_framework_to_db/migration.sql +37 -0
- package/prisma/migrations/20250516161852_cast_framework_id_and_requirement_id_to_string/migration.sql +5 -0
- package/prisma/migrations/20250516162324_convert_ids_to_new_format/migration.sql +31 -0
- package/prisma/migrations/20250516162730_convert_framework_id/migration.sql +5 -0
- package/prisma/migrations/20250516163156_added_relation_to_framework_and_requirement_maps/migration.sql +5 -0
- package/prisma/migrations/20250516164307_drop_enums/migration.sql +5 -0
- package/prisma/migrations/20250516194123_add_cal_option/migration.sql +2 -0
- package/prisma/migrations/20250518133218_add_booking_details/migration.sql +2 -0
- package/prisma/migrations/20250519141733_change_framework_id_to_string/migration.sql +3 -0
- package/prisma/migrations/20250519141735_drop_enum_on_requirements_map/migration.sql +2 -0
- package/prisma/migrations/20250519142913_add_template_references_to_instances/migration.sql +17 -0
- package/prisma/migrations/20250519172353_drop_artifacts/migration.sql +56 -0
- package/prisma/migrations/20250519204449_drop_relation_between_controls_and_framewrok_instance/migration.sql +14 -0
- package/prisma/migrations/20250519212347_add_visibility_toggle_to_framework_editor/migration.sql +2 -0
- package/prisma/migrations/20250520152548_add_approver_to_policy/migration.sql +5 -0
- package/prisma/migrations/20250520175109_add_description_to_audit_log_for_convenience/migration.sql +2 -0
- package/prisma/migrations/20250520175523_add_member_id_to_log_table/migration.sql +8 -0
- package/prisma/migrations/20250521140239_add_entity_type_and_id_for_audit_logs_for_easy_filtering/migration.sql +9 -0
- package/prisma/migrations/20250603135046_add_v2_onboarding_requirements/migration.sql +36 -0
- package/prisma/migrations/20250604155610_add_job_id_column_to_onboarding/migration.sql +2 -0
- package/prisma/migrations/20250605151521_make_framework_visibility_false/migration.sql +2 -0
- package/prisma/migrations/20250605184738_add_cascade_to_entities_owned_by_org/migration.sql +29 -0
- package/prisma/migrations/20250605184740_add_device_agent_details_to_org/migration.sql +18 -0
- package/prisma/migrations/20250609130129_add_not_relevant/migration.sql +2 -0
- package/prisma/migrations/20250610215328_add_fleet_label_to_employees/migration.sql +2 -0
- package/prisma/migrations/20250611144654_add_is_fleet_setup_flag/migration.sql +2 -0
- package/prisma/migrations/20250612160731_remove_unused_cols/migration.sql +10 -0
- package/prisma/migrations/20250618001304_add_default_slug/migration.sql +3 -0
- package/prisma/migrations/20250623184529_add_subscription_type/migration.sql +12 -0
- package/prisma/migrations/20250626021946_add_starter_subscription_type/migration.sql +27 -0
- package/prisma/migrations/20250626030206_added_new_subscription_type/migration.sql +2 -0
- package/prisma/migrations/20250627180331_add_onboaridng_field/migration.sql +5 -0
- package/prisma/migrations/20250627180828_rename_completed_col/migration.sql +15 -0
- package/prisma/migrations/20250708152414_add_had_call_col/migration.sql +2 -0
- package/prisma/migrations/20250711201749_update_retool_role_to_edit_had_call_column_in_organization_table/migration.sql +7 -0
- package/prisma/migrations/20250711204234_add_read_permission_for_where_clause_on_retool_role/migration.sql +8 -0
- package/prisma/migrations/20250714153009_remove_stripe_and_add_has_access/migration.sql +31 -0
- package/prisma/migrations/20250715200054_add_perms_for_has_access_for_retool/migration.sql +7 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/randomSecret.sql +12 -0
- package/prisma/schema/attachments.prisma +35 -0
- package/prisma/schema/auth.prisma +122 -0
- package/prisma/schema/comment.prisma +27 -0
- package/prisma/schema/context.prisma +18 -0
- package/prisma/schema/control.prisma +21 -0
- package/prisma/schema/framework-editor.prisma +96 -0
- package/prisma/schema/framework.prisma +14 -0
- package/prisma/schema/integration.prisma +32 -0
- package/prisma/schema/onboarding.prisma +18 -0
- package/prisma/schema/organization.prisma +34 -0
- package/prisma/schema/policy.prisma +32 -0
- package/prisma/schema/requirement.prisma +15 -0
- package/prisma/schema/risk.prisma +57 -0
- package/prisma/schema/shared.prisma +104 -0
- package/prisma/schema/task.prisma +41 -0
- package/prisma/schema/trust.prisma +37 -0
- package/prisma/schema/vendor.prisma +56 -0
- package/prisma/schema.prisma +12 -0
- package/prisma/seed/frameworkEditorSchemas.js +136 -0
- package/prisma/seed/frameworkEditorSchemas.ts +178 -0
- package/prisma/seed/primitives/FrameworkEditorControlTemplate.json +296 -0
- package/prisma/seed/primitives/FrameworkEditorFramework.json +101 -0
- package/prisma/seed/primitives/FrameworkEditorPolicyTemplate.json +6057 -0
- package/prisma/seed/primitives/FrameworkEditorRequirement.json +7841 -0
- package/prisma/seed/primitives/FrameworkEditorTaskTemplate.json +308 -0
- package/prisma/seed/primitives/FrameworkEditorVideo.json +47 -0
- package/prisma/seed/relations/_FrameworkEditorControlTemplateToFrameworkEditorPolicyTemplate.json +178 -0
- package/prisma/seed/relations/_FrameworkEditorControlTemplateToFrameworkEditorRequirement.json +470 -0
- package/prisma/seed/relations/_FrameworkEditorControlTemplateToFrameworkEditorTaskTemplate.json +142 -0
- package/prisma/seed/seed.js +160 -0
- package/prisma/seed/seed.ts +192 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `ownerId` on the `Vendor` table. All the data in the column will be lost.
|
|
5
|
+
- Added the required column `assigneeId` to the `Vendor` table without a default value. This is not possible if the table is not empty.
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
-- DropForeignKey
|
|
9
|
+
ALTER TABLE "Vendor" DROP CONSTRAINT "Vendor_ownerId_fkey";
|
|
10
|
+
|
|
11
|
+
-- DropIndex
|
|
12
|
+
DROP INDEX "Vendor_ownerId_idx";
|
|
13
|
+
|
|
14
|
+
-- AlterTable
|
|
15
|
+
ALTER TABLE "Vendor" DROP COLUMN "ownerId",
|
|
16
|
+
ADD COLUMN "assigneeId" TEXT NOT NULL;
|
|
17
|
+
|
|
18
|
+
-- CreateIndex
|
|
19
|
+
CREATE INDEX "Vendor_assigneeId_idx" ON "Vendor"("assigneeId");
|
|
20
|
+
|
|
21
|
+
-- AddForeignKey
|
|
22
|
+
ALTER TABLE "Vendor" ADD CONSTRAINT "Vendor_assigneeId_fkey" FOREIGN KEY ("assigneeId") REFERENCES "Member"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- DropForeignKey
|
|
2
|
+
ALTER TABLE "Task" DROP CONSTRAINT "Task_assigneeId_fkey";
|
|
3
|
+
|
|
4
|
+
-- AlterTable
|
|
5
|
+
ALTER TABLE "Task" ALTER COLUMN "assigneeId" DROP NOT NULL;
|
|
6
|
+
|
|
7
|
+
-- AddForeignKey
|
|
8
|
+
ALTER TABLE "Task" ADD CONSTRAINT "Task_assigneeId_fkey" FOREIGN KEY ("assigneeId") REFERENCES "Member"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "Comment" (
|
|
3
|
+
"id" TEXT NOT NULL DEFAULT generate_prefixed_cuid('cmt'::text),
|
|
4
|
+
"content" TEXT NOT NULL,
|
|
5
|
+
"entityId" TEXT NOT NULL,
|
|
6
|
+
"authorId" TEXT NOT NULL,
|
|
7
|
+
"organizationId" TEXT NOT NULL,
|
|
8
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
9
|
+
|
|
10
|
+
CONSTRAINT "Comment_pkey" PRIMARY KEY ("id")
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
-- CreateIndex
|
|
14
|
+
CREATE INDEX "Comment_entityId_idx" ON "Comment"("entityId");
|
|
15
|
+
|
|
16
|
+
-- AddForeignKey
|
|
17
|
+
ALTER TABLE "Comment" ADD CONSTRAINT "Comment_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "Member"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
18
|
+
|
|
19
|
+
-- AddForeignKey
|
|
20
|
+
ALTER TABLE "Comment" ADD CONSTRAINT "Comment_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- A unique constraint covering the columns `[organizationId,evidenceId,policyId]` on the table `Artifact` will be added. If there are existing duplicate values, this will fail.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- CreateIndex
|
|
8
|
+
CREATE UNIQUE INDEX "Artifact_organizationId_evidenceId_policyId_key" ON "Artifact"("organizationId", "evidenceId", "policyId");
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
-- Delete duplicate rows before adding unique constraint
|
|
12
|
+
WITH duplicates AS (
|
|
13
|
+
SELECT
|
|
14
|
+
"organizationId",
|
|
15
|
+
"evidenceId",
|
|
16
|
+
"policyId",
|
|
17
|
+
"id",
|
|
18
|
+
ROW_NUMBER() OVER (
|
|
19
|
+
PARTITION BY "organizationId", "evidenceId", "policyId"
|
|
20
|
+
ORDER BY "createdAt" ASC
|
|
21
|
+
) as row_num
|
|
22
|
+
FROM "Artifact"
|
|
23
|
+
WHERE "evidenceId" IS NOT NULL OR "policyId" IS NOT NULL
|
|
24
|
+
)
|
|
25
|
+
DELETE FROM "Artifact"
|
|
26
|
+
WHERE "id" IN (
|
|
27
|
+
SELECT "id"
|
|
28
|
+
FROM duplicates
|
|
29
|
+
WHERE "row_num" > 1
|
|
30
|
+
);
|
package/dist/prisma/migrations/20250410193857_remove_published_field_from_evidence/migration.sql
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `published` on the `Evidence` table. All the data in the column will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
-- Migrate data from published to status
|
|
9
|
+
UPDATE "Evidence" SET "status" = 'published' WHERE "published" = true;
|
|
10
|
+
|
|
11
|
+
-- AlterTable
|
|
12
|
+
ALTER TABLE "Evidence" DROP COLUMN "published";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "Onboarding" (
|
|
3
|
+
"organizationId" TEXT NOT NULL,
|
|
4
|
+
"policies" BOOLEAN NOT NULL DEFAULT false,
|
|
5
|
+
"employees" BOOLEAN NOT NULL DEFAULT false,
|
|
6
|
+
"vendors" BOOLEAN NOT NULL DEFAULT false,
|
|
7
|
+
"integrations" BOOLEAN NOT NULL DEFAULT false,
|
|
8
|
+
"risk" BOOLEAN NOT NULL DEFAULT false,
|
|
9
|
+
"team" BOOLEAN NOT NULL DEFAULT false,
|
|
10
|
+
|
|
11
|
+
CONSTRAINT "Onboarding_pkey" PRIMARY KEY ("organizationId")
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
-- CreateIndex
|
|
15
|
+
CREATE INDEX "Onboarding_organizationId_idx" ON "Onboarding"("organizationId");
|
|
16
|
+
|
|
17
|
+
-- AddForeignKey
|
|
18
|
+
ALTER TABLE "Onboarding" ADD CONSTRAINT "Onboarding_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
19
|
+
|
|
20
|
+
-- Insert onboarding records for existing organizations
|
|
21
|
+
INSERT INTO "Onboarding" ("organizationId")
|
|
22
|
+
SELECT
|
|
23
|
+
id
|
|
24
|
+
FROM "Organization"
|
|
25
|
+
WHERE id NOT IN (SELECT "organizationId" FROM "Onboarding");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "GlobalVendors" (
|
|
3
|
+
"website" TEXT NOT NULL,
|
|
4
|
+
"company_name" TEXT,
|
|
5
|
+
"legal_name" TEXT,
|
|
6
|
+
"company_description" TEXT,
|
|
7
|
+
"company_hq_address" TEXT,
|
|
8
|
+
"privacy_policy_url" TEXT,
|
|
9
|
+
"terms_of_service_url" TEXT,
|
|
10
|
+
"service_level_agreement_url" TEXT,
|
|
11
|
+
"security_page_url" TEXT,
|
|
12
|
+
"trust_page_url" TEXT,
|
|
13
|
+
"security_certifications" TEXT[],
|
|
14
|
+
"subprocessors" TEXT[],
|
|
15
|
+
"type_of_company" TEXT,
|
|
16
|
+
"approved" BOOLEAN NOT NULL DEFAULT false,
|
|
17
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
18
|
+
|
|
19
|
+
CONSTRAINT "GlobalVendors_pkey" PRIMARY KEY ("website")
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
-- CreateIndex
|
|
23
|
+
CREATE UNIQUE INDEX "GlobalVendors_website_key" ON "GlobalVendors"("website");
|
|
24
|
+
|
|
25
|
+
-- CreateIndex
|
|
26
|
+
CREATE INDEX "GlobalVendors_website_idx" ON "GlobalVendors"("website");
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- The values [open,closed] on the enum `TaskStatus` will be removed. If these variants are still used in the database, this will fail.
|
|
5
|
+
- You are about to drop the column `dueDate` on the `Task` table. All the data in the column will be lost.
|
|
6
|
+
- You are about to drop the column `relatedId` on the `Task` table. All the data in the column will be lost.
|
|
7
|
+
- You are about to drop the column `relatedType` on the `Task` table. All the data in the column will be lost.
|
|
8
|
+
- Added the required column `entityType` to the `Comment` table without a default value. This is not possible if the table is not empty.
|
|
9
|
+
- Added the required column `entityId` to the `Task` table without a default value. This is not possible if the table is not empty.
|
|
10
|
+
- Added the required column `entityType` to the `Task` table without a default value. This is not possible if the table is not empty.
|
|
11
|
+
- Added the required column `frequency` to the `Task` table without a default value. This is not possible if the table is not empty.
|
|
12
|
+
|
|
13
|
+
*/
|
|
14
|
+
-- CreateEnum
|
|
15
|
+
CREATE TYPE "AttachmentEntityType" AS ENUM ('task', 'vendor', 'risk', 'comment');
|
|
16
|
+
|
|
17
|
+
-- CreateEnum
|
|
18
|
+
CREATE TYPE "AttachmentType" AS ENUM ('image', 'video', 'audio', 'document', 'other');
|
|
19
|
+
|
|
20
|
+
-- CreateEnum
|
|
21
|
+
CREATE TYPE "CommentEntityType" AS ENUM ('task', 'vendor', 'risk', 'policy');
|
|
22
|
+
|
|
23
|
+
-- CreateEnum
|
|
24
|
+
CREATE TYPE "TaskFrequency" AS ENUM ('daily', 'weekly', 'monthly', 'quarterly', 'yearly');
|
|
25
|
+
|
|
26
|
+
-- CreateEnum
|
|
27
|
+
CREATE TYPE "TaskEntityType" AS ENUM ('control', 'vendor', 'risk');
|
|
28
|
+
|
|
29
|
+
-- AlterEnum
|
|
30
|
+
BEGIN;
|
|
31
|
+
CREATE TYPE "TaskStatus_new" AS ENUM ('todo', 'in_progress', 'done');
|
|
32
|
+
ALTER TABLE "Task" ALTER COLUMN "status" DROP DEFAULT;
|
|
33
|
+
ALTER TABLE "Task" ALTER COLUMN "status" TYPE "TaskStatus_new" USING ("status"::text::"TaskStatus_new");
|
|
34
|
+
ALTER TYPE "TaskStatus" RENAME TO "TaskStatus_old";
|
|
35
|
+
ALTER TYPE "TaskStatus_new" RENAME TO "TaskStatus";
|
|
36
|
+
DROP TYPE "TaskStatus_old";
|
|
37
|
+
ALTER TABLE "Task" ALTER COLUMN "status" SET DEFAULT 'todo';
|
|
38
|
+
COMMIT;
|
|
39
|
+
|
|
40
|
+
-- DropIndex
|
|
41
|
+
DROP INDEX "Task_relatedId_idx";
|
|
42
|
+
|
|
43
|
+
-- DropIndex
|
|
44
|
+
DROP INDEX "Task_relatedId_organizationId_idx";
|
|
45
|
+
|
|
46
|
+
-- AlterTable
|
|
47
|
+
ALTER TABLE "Comment" ADD COLUMN "entityType" "CommentEntityType" NOT NULL;
|
|
48
|
+
|
|
49
|
+
-- AlterTable
|
|
50
|
+
ALTER TABLE "Task" DROP COLUMN "dueDate",
|
|
51
|
+
DROP COLUMN "relatedId",
|
|
52
|
+
DROP COLUMN "relatedType",
|
|
53
|
+
ADD COLUMN "entityId" TEXT NOT NULL,
|
|
54
|
+
ADD COLUMN "entityType" "TaskEntityType" NOT NULL,
|
|
55
|
+
ADD COLUMN "frequency" "TaskFrequency" NOT NULL,
|
|
56
|
+
ADD COLUMN "lastCompletedAt" TIMESTAMP(3),
|
|
57
|
+
ADD COLUMN "department" "Departments" DEFAULT 'none',
|
|
58
|
+
ADD COLUMN "order" INTEGER NOT NULL DEFAULT 0,
|
|
59
|
+
ALTER COLUMN "status" SET DEFAULT 'todo';
|
|
60
|
+
|
|
61
|
+
-- DropEnum
|
|
62
|
+
DROP TYPE "TaskType";
|
|
63
|
+
|
|
64
|
+
-- CreateTable
|
|
65
|
+
CREATE TABLE "Attachment" (
|
|
66
|
+
"id" TEXT NOT NULL DEFAULT generate_prefixed_cuid('att'::text),
|
|
67
|
+
"name" TEXT NOT NULL,
|
|
68
|
+
"url" TEXT NOT NULL,
|
|
69
|
+
"type" "AttachmentType" NOT NULL,
|
|
70
|
+
"entityId" TEXT NOT NULL,
|
|
71
|
+
"entityType" "AttachmentEntityType" NOT NULL,
|
|
72
|
+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
73
|
+
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
74
|
+
"organizationId" TEXT NOT NULL,
|
|
75
|
+
|
|
76
|
+
CONSTRAINT "Attachment_pkey" PRIMARY KEY ("id")
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
-- CreateIndex
|
|
80
|
+
CREATE INDEX "Task_entityId_idx" ON "Task"("entityId");
|
|
81
|
+
|
|
82
|
+
-- CreateIndex
|
|
83
|
+
CREATE INDEX "Task_entityId_organizationId_idx" ON "Task"("entityId", "organizationId");
|
|
84
|
+
|
|
85
|
+
-- AddForeignKey
|
|
86
|
+
ALTER TABLE "Attachment" ADD CONSTRAINT "Attachment_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `evidenceId` on the `Artifact` table. All the data in the column will be lost.
|
|
5
|
+
- You are about to drop the `Evidence` table. If the table is not empty, all the data it contains will be lost.
|
|
6
|
+
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
-- Add temporary column to Task to store original Evidence ID
|
|
10
|
+
ALTER TABLE "Task" ADD COLUMN "temp_evidence_id" TEXT;
|
|
11
|
+
|
|
12
|
+
-- Migrate existing Evidence records (excluding 'not_relevant') to Tasks
|
|
13
|
+
-- Joins Evidence -> Artifact (via evidenceId) -> _ArtifactToControl -> Control
|
|
14
|
+
-- Uses DISTINCT ON(e.id) to create one Task per Evidence.
|
|
15
|
+
-- IMPORTANT: This runs BEFORE dropping Artifact.evidenceId
|
|
16
|
+
INSERT INTO "Task" (
|
|
17
|
+
"title",
|
|
18
|
+
"description",
|
|
19
|
+
"status",
|
|
20
|
+
"entityId", -- Control.id obtained via joins
|
|
21
|
+
"entityType",
|
|
22
|
+
"frequency", -- Taken from Evidence.frequency, defaulting to quarterly if NULL
|
|
23
|
+
"assigneeId",
|
|
24
|
+
"organizationId",
|
|
25
|
+
"createdAt",
|
|
26
|
+
"updatedAt",
|
|
27
|
+
"lastCompletedAt", -- Set to NOW() if Evidence was published, else NULL
|
|
28
|
+
"temp_evidence_id", -- Store original Evidence ID temporarily
|
|
29
|
+
"order"
|
|
30
|
+
)
|
|
31
|
+
SELECT DISTINCT ON (e.id)
|
|
32
|
+
e."name",
|
|
33
|
+
e."description",
|
|
34
|
+
CASE e."status"
|
|
35
|
+
WHEN 'published' THEN 'done'::"TaskStatus"
|
|
36
|
+
ELSE 'todo'::"TaskStatus"
|
|
37
|
+
END AS status,
|
|
38
|
+
c.id AS "entityId", -- Control ID from join
|
|
39
|
+
'control'::"TaskEntityType",
|
|
40
|
+
COALESCE(e.frequency::text, 'quarterly')::"TaskFrequency" AS frequency, -- Use Evidence frequency or default
|
|
41
|
+
e."assigneeId",
|
|
42
|
+
e."organizationId",
|
|
43
|
+
e."createdAt",
|
|
44
|
+
e."updatedAt",
|
|
45
|
+
CASE WHEN e."status" = 'published' THEN NOW() ELSE NULL END AS "lastCompletedAt", -- Set based on Evidence status
|
|
46
|
+
e.id -- Original Evidence ID for linking attachments
|
|
47
|
+
, row_number() OVER () - 1 AS "order"
|
|
48
|
+
FROM "Evidence" e
|
|
49
|
+
INNER JOIN "Artifact" a ON e.id = a."evidenceId" -- Join Evidence to Artifact via the old FK column
|
|
50
|
+
INNER JOIN "_ArtifactToControl" atc ON a.id = atc."A" -- Join Artifact to M2M table
|
|
51
|
+
INNER JOIN "Control" c ON atc."B" = c.id -- Join M2M table to Control
|
|
52
|
+
WHERE e."status" <> 'not_relevant'; -- Exclude evidence marked as not relevant
|
|
53
|
+
|
|
54
|
+
-- Migrate Evidence fileUrls to Attachments
|
|
55
|
+
INSERT INTO "Attachment" (
|
|
56
|
+
"name", -- Derived from URL
|
|
57
|
+
"url", -- From Evidence.fileUrls array
|
|
58
|
+
"type", -- Defaulting to 'document'
|
|
59
|
+
"entityId", -- Task.id found via temp_evidence_id
|
|
60
|
+
"entityType", -- 'task'
|
|
61
|
+
"organizationId",
|
|
62
|
+
"createdAt", -- Set explicitly
|
|
63
|
+
"updatedAt" -- Set explicitly
|
|
64
|
+
)
|
|
65
|
+
SELECT
|
|
66
|
+
substring(file_url from '[^/]*$') AS name, -- Extract filename from URL
|
|
67
|
+
file_url AS url,
|
|
68
|
+
'document'::"AttachmentType" AS type,
|
|
69
|
+
t.id AS "entityId",
|
|
70
|
+
'task'::"AttachmentEntityType" AS entityType,
|
|
71
|
+
t."organizationId",
|
|
72
|
+
NOW() AS "createdAt", -- Use current time
|
|
73
|
+
NOW() AS "updatedAt" -- Use current time
|
|
74
|
+
FROM "Evidence" e
|
|
75
|
+
CROSS JOIN LATERAL unnest(e."fileUrls") AS file_url -- Unnest the array of URLs
|
|
76
|
+
INNER JOIN "Task" t ON e.id = t."temp_evidence_id" -- Link Evidence to Task via temp column
|
|
77
|
+
WHERE e."status" <> 'not_relevant'; -- Ensure we only process migrated evidence
|
|
78
|
+
|
|
79
|
+
-- Drop temporary column from Task
|
|
80
|
+
ALTER TABLE "Task" DROP COLUMN "temp_evidence_id";
|
|
81
|
+
|
|
82
|
+
-- Delete Artifact rows of type 'evidence' as they are now represented by Tasks
|
|
83
|
+
DELETE FROM "Artifact" WHERE type = 'evidence';
|
|
84
|
+
|
|
85
|
+
-- Now clean up the Artifact table relating to the old evidenceId
|
|
86
|
+
-- DropForeignKey
|
|
87
|
+
ALTER TABLE "Artifact" DROP CONSTRAINT IF EXISTS "Artifact_evidenceId_fkey";
|
|
88
|
+
|
|
89
|
+
-- DropIndex
|
|
90
|
+
DROP INDEX IF EXISTS "Artifact_organizationId_evidenceId_policyId_key";
|
|
91
|
+
|
|
92
|
+
-- AlterTable
|
|
93
|
+
ALTER TABLE "Artifact" DROP COLUMN IF EXISTS "evidenceId";
|
|
94
|
+
|
|
95
|
+
-- Clean up Evidence table foreign keys before dropping
|
|
96
|
+
-- DropForeignKey
|
|
97
|
+
ALTER TABLE "Evidence" DROP CONSTRAINT IF EXISTS "Evidence_assigneeId_fkey";
|
|
98
|
+
|
|
99
|
+
-- DropForeignKey
|
|
100
|
+
ALTER TABLE "Evidence" DROP CONSTRAINT IF EXISTS "Evidence_organizationId_fkey";
|
|
101
|
+
|
|
102
|
+
-- Drop the Evidence table and its enum
|
|
103
|
+
-- DropTable
|
|
104
|
+
DROP TABLE "Evidence";
|
|
105
|
+
|
|
106
|
+
-- DropEnum
|
|
107
|
+
DROP TYPE "EvidenceStatus";
|
|
108
|
+
|
|
109
|
+
ALTER TABLE "Attachment" ALTER COLUMN "updatedAt" DROP DEFAULT;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE "Attachment" ADD COLUMN "commentId" TEXT;
|
|
3
|
+
|
|
4
|
+
-- CreateIndex
|
|
5
|
+
CREATE INDEX "Attachment_entityId_entityType_idx" ON "Attachment"("entityId", "entityType");
|
|
6
|
+
|
|
7
|
+
-- AddForeignKey
|
|
8
|
+
ALTER TABLE "Attachment" ADD CONSTRAINT "Attachment_commentId_fkey" FOREIGN KEY ("commentId") REFERENCES "Comment"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- AlterTable
|
|
2
|
+
ALTER TABLE "Invitation" DROP COLUMN "role",
|
|
3
|
+
ADD COLUMN "role" TEXT NOT NULL DEFAULT 'member';
|
|
4
|
+
|
|
5
|
+
-- AlterTable
|
|
6
|
+
ALTER TABLE "Member" ALTER COLUMN "role" TYPE TEXT USING role::TEXT;
|
|
7
|
+
|
|
8
|
+
-- Remove default value from Invitation role column
|
|
9
|
+
ALTER TABLE "Invitation" ALTER COLUMN "role" DROP DEFAULT;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- The values [evidence] on the enum `ArtifactType` will be removed. If these variants are still used in the database, this will fail.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- AlterEnum
|
|
8
|
+
BEGIN;
|
|
9
|
+
CREATE TYPE "ArtifactType_new" AS ENUM ('policy', 'procedure', 'training');
|
|
10
|
+
ALTER TABLE "Artifact" ALTER COLUMN "type" TYPE "ArtifactType_new" USING ("type"::text::"ArtifactType_new");
|
|
11
|
+
ALTER TYPE "ArtifactType" RENAME TO "ArtifactType_old";
|
|
12
|
+
ALTER TYPE "ArtifactType_new" RENAME TO "ArtifactType";
|
|
13
|
+
DROP TYPE "ArtifactType_old";
|
|
14
|
+
COMMIT;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- Added the required column `version` to the `FrameworkEditorFramework` table without a default value. This is not possible if the table is not empty.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- AlterTable
|
|
8
|
+
ALTER TABLE "FrameworkEditorFramework" ADD COLUMN "version" TEXT NOT NULL;
|
|
9
|
+
|
|
10
|
+
-- CreateTable
|
|
11
|
+
CREATE TABLE "FrameworkEditorVideo" (
|
|
12
|
+
"id" TEXT NOT NULL DEFAULT generate_prefixed_cuid('frk_vi'::text),
|
|
13
|
+
"title" TEXT NOT NULL,
|
|
14
|
+
"description" TEXT NOT NULL,
|
|
15
|
+
"youtubeId" TEXT NOT NULL,
|
|
16
|
+
"url" TEXT NOT NULL,
|
|
17
|
+
|
|
18
|
+
CONSTRAINT "FrameworkEditorVideo_pkey" PRIMARY KEY ("id")
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
-- CreateTable
|
|
22
|
+
CREATE TABLE "FrameworkEditorRequirement" (
|
|
23
|
+
"id" TEXT NOT NULL DEFAULT generate_prefixed_cuid('frk_rq'::text),
|
|
24
|
+
"frameworkId" TEXT NOT NULL,
|
|
25
|
+
"name" TEXT NOT NULL,
|
|
26
|
+
"description" TEXT NOT NULL,
|
|
27
|
+
|
|
28
|
+
CONSTRAINT "FrameworkEditorRequirement_pkey" PRIMARY KEY ("id")
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
-- CreateTable
|
|
32
|
+
CREATE TABLE "FrameworkEditorPolicyTemplate" (
|
|
33
|
+
"id" TEXT NOT NULL DEFAULT generate_prefixed_cuid('frk_pt'::text),
|
|
34
|
+
"slug" TEXT NOT NULL,
|
|
35
|
+
"name" TEXT NOT NULL,
|
|
36
|
+
"description" TEXT NOT NULL,
|
|
37
|
+
"frequency" "Frequency" NOT NULL,
|
|
38
|
+
"department" "Departments" NOT NULL,
|
|
39
|
+
"content" JSONB NOT NULL,
|
|
40
|
+
|
|
41
|
+
CONSTRAINT "FrameworkEditorPolicyTemplate_pkey" PRIMARY KEY ("id")
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
-- CreateTable
|
|
45
|
+
CREATE TABLE "FrameworkEditorTaskTemplate" (
|
|
46
|
+
"id" TEXT NOT NULL DEFAULT generate_prefixed_cuid('frk_tt'::text),
|
|
47
|
+
"name" TEXT NOT NULL,
|
|
48
|
+
"description" TEXT NOT NULL,
|
|
49
|
+
"frequency" "Frequency" NOT NULL,
|
|
50
|
+
"department" "Departments" NOT NULL,
|
|
51
|
+
|
|
52
|
+
CONSTRAINT "FrameworkEditorTaskTemplate_pkey" PRIMARY KEY ("id")
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
-- CreateTable
|
|
56
|
+
CREATE TABLE "FrameworkEditorControlTemplate" (
|
|
57
|
+
"id" TEXT NOT NULL DEFAULT generate_prefixed_cuid('frk_ct'::text),
|
|
58
|
+
"name" TEXT NOT NULL,
|
|
59
|
+
"description" TEXT NOT NULL,
|
|
60
|
+
|
|
61
|
+
CONSTRAINT "FrameworkEditorControlTemplate_pkey" PRIMARY KEY ("id")
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
-- CreateTable
|
|
65
|
+
CREATE TABLE "_FrameworkEditorControlTemplateToFrameworkEditorPolicyTemplate" (
|
|
66
|
+
"A" TEXT NOT NULL,
|
|
67
|
+
"B" TEXT NOT NULL,
|
|
68
|
+
|
|
69
|
+
CONSTRAINT "_FrameworkEditorControlTemplateToFrameworkEditorPolicyT_AB_pkey" PRIMARY KEY ("A","B")
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
-- CreateTable
|
|
73
|
+
CREATE TABLE "_FrameworkEditorControlTemplateToFrameworkEditorRequirement" (
|
|
74
|
+
"A" TEXT NOT NULL,
|
|
75
|
+
"B" TEXT NOT NULL,
|
|
76
|
+
|
|
77
|
+
CONSTRAINT "_FrameworkEditorControlTemplateToFrameworkEditorRequire_AB_pkey" PRIMARY KEY ("A","B")
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
-- CreateTable
|
|
81
|
+
CREATE TABLE "_FrameworkEditorControlTemplateToFrameworkEditorTaskTemplate" (
|
|
82
|
+
"A" TEXT NOT NULL,
|
|
83
|
+
"B" TEXT NOT NULL,
|
|
84
|
+
|
|
85
|
+
CONSTRAINT "_FrameworkEditorControlTemplateToFrameworkEditorTaskTem_AB_pkey" PRIMARY KEY ("A","B")
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
-- CreateIndex
|
|
89
|
+
CREATE UNIQUE INDEX "FrameworkEditorRequirement_frameworkId_name_key" ON "FrameworkEditorRequirement"("frameworkId", "name");
|
|
90
|
+
|
|
91
|
+
-- CreateIndex
|
|
92
|
+
CREATE UNIQUE INDEX "FrameworkEditorPolicyTemplate_slug_key" ON "FrameworkEditorPolicyTemplate"("slug");
|
|
93
|
+
|
|
94
|
+
-- CreateIndex
|
|
95
|
+
CREATE INDEX "_FrameworkEditorControlTemplateToFrameworkEditorPolicyT_B_index" ON "_FrameworkEditorControlTemplateToFrameworkEditorPolicyTemplate"("B");
|
|
96
|
+
|
|
97
|
+
-- CreateIndex
|
|
98
|
+
CREATE INDEX "_FrameworkEditorControlTemplateToFrameworkEditorRequire_B_index" ON "_FrameworkEditorControlTemplateToFrameworkEditorRequirement"("B");
|
|
99
|
+
|
|
100
|
+
-- CreateIndex
|
|
101
|
+
CREATE INDEX "_FrameworkEditorControlTemplateToFrameworkEditorTaskTem_B_index" ON "_FrameworkEditorControlTemplateToFrameworkEditorTaskTemplate"("B");
|
|
102
|
+
|
|
103
|
+
-- AddForeignKey
|
|
104
|
+
ALTER TABLE "FrameworkEditorRequirement" ADD CONSTRAINT "FrameworkEditorRequirement_frameworkId_fkey" FOREIGN KEY ("frameworkId") REFERENCES "FrameworkEditorFramework"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
105
|
+
|
|
106
|
+
-- AddForeignKey
|
|
107
|
+
ALTER TABLE "_FrameworkEditorControlTemplateToFrameworkEditorPolicyTemplate" ADD CONSTRAINT "_FrameworkEditorControlTemplateToFrameworkEditorPolicyTe_A_fkey" FOREIGN KEY ("A") REFERENCES "FrameworkEditorControlTemplate"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
108
|
+
|
|
109
|
+
-- AddForeignKey
|
|
110
|
+
ALTER TABLE "_FrameworkEditorControlTemplateToFrameworkEditorPolicyTemplate" ADD CONSTRAINT "_FrameworkEditorControlTemplateToFrameworkEditorPolicyTe_B_fkey" FOREIGN KEY ("B") REFERENCES "FrameworkEditorPolicyTemplate"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
111
|
+
|
|
112
|
+
-- AddForeignKey
|
|
113
|
+
ALTER TABLE "_FrameworkEditorControlTemplateToFrameworkEditorRequirement" ADD CONSTRAINT "_FrameworkEditorControlTemplateToFrameworkEditorRequirem_A_fkey" FOREIGN KEY ("A") REFERENCES "FrameworkEditorControlTemplate"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
114
|
+
|
|
115
|
+
-- AddForeignKey
|
|
116
|
+
ALTER TABLE "_FrameworkEditorControlTemplateToFrameworkEditorRequirement" ADD CONSTRAINT "_FrameworkEditorControlTemplateToFrameworkEditorRequirem_B_fkey" FOREIGN KEY ("B") REFERENCES "FrameworkEditorRequirement"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
117
|
+
|
|
118
|
+
-- AddForeignKey
|
|
119
|
+
ALTER TABLE "_FrameworkEditorControlTemplateToFrameworkEditorTaskTemplate" ADD CONSTRAINT "_FrameworkEditorControlTemplateToFrameworkEditorTaskTemp_A_fkey" FOREIGN KEY ("A") REFERENCES "FrameworkEditorControlTemplate"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
120
|
+
|
|
121
|
+
-- AddForeignKey
|
|
122
|
+
ALTER TABLE "_FrameworkEditorControlTemplateToFrameworkEditorTaskTemplate" ADD CONSTRAINT "_FrameworkEditorControlTemplateToFrameworkEditorTaskTemp_B_fkey" FOREIGN KEY ("B") REFERENCES "FrameworkEditorTaskTemplate"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Warnings:
|
|
3
|
+
|
|
4
|
+
- You are about to drop the column `slug` on the `FrameworkEditorPolicyTemplate` table. All the data in the column will be lost.
|
|
5
|
+
|
|
6
|
+
*/
|
|
7
|
+
-- DropIndex
|
|
8
|
+
DROP INDEX "FrameworkEditorPolicyTemplate_slug_key";
|
|
9
|
+
|
|
10
|
+
-- AlterTable
|
|
11
|
+
ALTER TABLE "FrameworkEditorPolicyTemplate" DROP COLUMN "slug";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "TrustStatus" AS ENUM ('draft', 'published');
|
|
3
|
+
|
|
4
|
+
-- CreateTable
|
|
5
|
+
CREATE TABLE "Trust" (
|
|
6
|
+
"organizationId" TEXT NOT NULL,
|
|
7
|
+
"status" "TrustStatus" NOT NULL DEFAULT 'draft',
|
|
8
|
+
"email" TEXT,
|
|
9
|
+
"privacyPolicy" TEXT,
|
|
10
|
+
"soc2" BOOLEAN NOT NULL DEFAULT false,
|
|
11
|
+
"iso27001" BOOLEAN NOT NULL DEFAULT false,
|
|
12
|
+
"gdpr" BOOLEAN NOT NULL DEFAULT false,
|
|
13
|
+
|
|
14
|
+
CONSTRAINT "Trust_pkey" PRIMARY KEY ("status","organizationId")
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
-- CreateIndex
|
|
18
|
+
CREATE INDEX "Trust_organizationId_idx" ON "Trust"("organizationId");
|
|
19
|
+
|
|
20
|
+
-- CreateIndex
|
|
21
|
+
CREATE UNIQUE INDEX "Trust_organizationId_key" ON "Trust"("organizationId");
|
|
22
|
+
|
|
23
|
+
-- AddForeignKey
|
|
24
|
+
ALTER TABLE "Trust" ADD CONSTRAINT "Trust_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "Organization"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- CreateEnum
|
|
2
|
+
CREATE TYPE "FrameworkStatus" AS ENUM ('started', 'in_progress', 'compliant');
|
|
3
|
+
|
|
4
|
+
-- AlterTable
|
|
5
|
+
ALTER TABLE "Trust" ADD COLUMN "gdpr_status" "FrameworkStatus" NOT NULL DEFAULT 'started',
|
|
6
|
+
ADD COLUMN "iso27001_status" "FrameworkStatus" NOT NULL DEFAULT 'started',
|
|
7
|
+
ADD COLUMN "soc2_status" "FrameworkStatus" NOT NULL DEFAULT 'started';
|