-
Notifications
You must be signed in to change notification settings - Fork 13
#5594 - Analysis: new unified data path for appeals and forms + non punitive (DB migrations) #5649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces the database schema foundation for a unified approach to handling appeals and form submissions. It creates new tables and enums to support a flexible form submission system where multiple forms can be grouped together as a bundle or submitted independently.
Changes:
- Added four new PostgreSQL enum types for form categorization and submission workflows
- Created two new database tables (form_submissions and form_submission_items) to store submitted forms and their assessment status
- Extended the dynamic_form_configurations table with form category and grouping type columns
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| sources/packages/backend/libs/sims-db/src/entities/index.ts | Exports new enum types and FormSubmission model (missing FormSubmissionItem and FormSubmissionDecisionStatus exports) |
| sources/packages/backend/libs/sims-db/src/entities/form-submission.model.ts | Defines FormSubmission entity to track form submission bundles |
| sources/packages/backend/libs/sims-db/src/entities/form-submission-item.model.ts | Defines FormSubmissionItem entity for individual forms within a submission |
| sources/packages/backend/libs/sims-db/src/entities/form-submission-status.type.ts | Enum for submission-level status (Pending, Completed, Declined) |
| sources/packages/backend/libs/sims-db/src/entities/form-submission-grouping.type.ts | Enum defining how forms are grouped (Application bundle vs Student standalone) |
| sources/packages/backend/libs/sims-db/src/entities/form-submission-decision-status.type.ts | Enum for item-level decision status (Pending, Approved, Declined) |
| sources/packages/backend/libs/sims-db/src/entities/form-category.type.ts | Enum for form categories (Student appeal, Student form, System) |
| sources/packages/backend/libs/sims-db/src/entities/dynamic-form-configuration.model.ts | Adds formCategory and formSubmissionGroupingType properties to support new workflow |
| sources/packages/backend/libs/sims-db/src/constant.ts | Adds table name constants for new tables |
| sources/packages/backend/apps/db-migrations/src/sql/Types/Create-form-submission-related-types.sql | Creates PostgreSQL enum types for form submission workflow |
| sources/packages/backend/apps/db-migrations/src/sql/Types/Rollback-create-form-submission-related-types.sql | Rollback script for enum types |
| sources/packages/backend/apps/db-migrations/src/sql/FormSubmissions/Create-form-submissions-table.sql | Creates form_submissions table with constraints |
| sources/packages/backend/apps/db-migrations/src/sql/FormSubmissions/Rollback-create-form-submissions-table.sql | Rollback script for form_submissions table |
| sources/packages/backend/apps/db-migrations/src/sql/FormSubmissionItems/Create-form-submission-items-table.sql | Creates form_submission_items table |
| sources/packages/backend/apps/db-migrations/src/sql/FormSubmissionItems/Rollback-create-form-submission-items-table.sql | Rollback script for form_submission_items table |
| sources/packages/backend/apps/db-migrations/src/sql/DynamicFormConfigurations/Add-form-submission-grouping-type-column.sql | Adds new columns and seed data to dynamic_form_configurations |
| sources/packages/backend/apps/db-migrations/src/sql/DynamicFormConfigurations/Rollback-add-form-submission-grouping-type-column.sql | Rollback script for dynamic_form_configurations changes |
| sources/packages/backend/apps/db-migrations/src/migrations/1768863388343-CreateFormSubmissionRelatedTypes.ts | TypeScript migration wrapper for creating enum types |
| sources/packages/backend/apps/db-migrations/src/migrations/1768863415862-CreateFormSubmissionsTable.ts | TypeScript migration wrapper for creating form_submissions table |
| sources/packages/backend/apps/db-migrations/src/migrations/1768863437173-CreateFormSubmissionItemsTable.ts | TypeScript migration wrapper for creating form_submission_items table |
| sources/packages/backend/apps/db-migrations/src/migrations/1768863470903-DynamicFormConfigurationsAddFormSubmissionGroupingTypeColumn.ts | TypeScript migration wrapper for extending dynamic_form_configurations |
| sims.code-workspace | Formatting updates (adding trailing commas for consistency) |
| name: "form_category", | ||
| type: "enum", | ||
| enum: FormCategory, | ||
| enumName: "FormCategory", |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enumName should reference the actual PostgreSQL enum type name created in the migration. The SQL creates 'form_category_types' (see Create-form-submission-related-types.sql line 1 and this column uses it on Create-form-submissions-table.sql line 6), but this specifies 'FormCategory'. This mismatch will cause runtime errors. Change enumName to 'form_category_types'.
| enumName: "FormCategory", | |
| enumName: "form_category_types", |
| name: "submission_status", | ||
| type: "enum", | ||
| enum: FormSubmissionStatus, | ||
| enumName: "FormSubmissionStatus", |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enumName should reference the actual PostgreSQL enum type name created in the migration. The SQL creates 'form_submission_status' (see Create-form-submission-related-types.sql line 16 and this column uses it on Create-form-submissions-table.sql line 8), but this specifies 'FormSubmissionStatus'. This mismatch will cause runtime errors. Change enumName to 'form_submission_status'.
| enumName: "FormSubmissionStatus", | |
| enumName: "form_submission_status", |
| name: "submission_status", | ||
| type: "enum", | ||
| enum: FormSubmissionDecisionStatus, | ||
| enumName: "FormSubmissionDecisionStatus", |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enumName should reference the actual PostgreSQL enum type name created in the migration. The SQL creates 'form_submission_decision_status' (see Create-form-submission-related-types.sql line 24 and this column uses it on Create-form-submission-items-table.sql line 6), but this specifies 'FormSubmissionDecisionStatus'. This mismatch will cause runtime errors. Change enumName to 'form_submission_decision_status'.
| enumName: "FormSubmissionDecisionStatus", | |
| enumName: "form_submission_decision_status", |
| name: "form_category", | ||
| type: "enum", | ||
| enum: FormCategory, | ||
| enumName: "FormCategory", |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enumName should reference the actual PostgreSQL enum type name created in the migration. The SQL creates 'form_category_types' (see Create-form-submission-related-types.sql line 1 and the Add-form-submission-grouping-type-column.sql uses it on line 4), but this specifies 'FormCategory'. This mismatch will cause runtime errors. Change enumName to 'form_category_types'.
| enumName: "FormCategory", | |
| enumName: "form_category_types", |
| -- Constraints comments. | ||
| COMMENT ON CONSTRAINT form_submissions_application_id_constraint ON sims.form_submissions IS 'Ensures application_id is present when submission_grouping_type is application-related.'; | ||
|
|
||
| COMMENT ON CONSTRAINT form_submissions_assessed_fields_required_constraint ON sims.form_submissions IS 'Requires assessed_date, assessed_by, and assessed_student_note_id when submission_status is not Pending.'; No newline at end of file |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constraint comment refers to 'assessed_student_note_id' but the actual column name in the table is 'assessed_note_id'. The comment should reference the correct column name to match the constraint definition on lines 28-38.
| COMMENT ON CONSTRAINT form_submissions_assessed_fields_required_constraint ON sims.form_submissions IS 'Requires assessed_date, assessed_by, and assessed_student_note_id when submission_status is not Pending.'; | |
| COMMENT ON CONSTRAINT form_submissions_assessed_fields_required_constraint ON sims.form_submissions IS 'Requires assessed_date, assessed_by, and assessed_note_id when submission_status is not Pending.'; |
| name: "submission_grouping_type", | ||
| type: "enum", | ||
| enum: FormSubmissionGrouping, | ||
| enumName: "FormSubmissionGrouping", |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enumName should reference the actual PostgreSQL enum type name created in the migration. The SQL creates 'form_submission_grouping_types' (see Create-form-submission-related-types.sql line 9 and this column uses it on Create-form-submissions-table.sql line 7), but this specifies 'FormSubmissionGrouping'. This mismatch will cause runtime errors. Change enumName to 'form_submission_grouping_types'.
| enumName: "FormSubmissionGrouping", | |
| enumName: "form_submission_grouping_types", |
| name: "form_submission_grouping_type", | ||
| type: "enum", | ||
| enum: FormSubmissionGrouping, | ||
| enumName: "FormSubmissionGrouping", |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enumName should reference the actual PostgreSQL enum type name created in the migration. The SQL creates 'form_submission_grouping_types' (see Create-form-submission-related-types.sql line 9 and the Add-form-submission-grouping-type-column.sql uses it on line 6), but this specifies 'FormSubmissionGrouping'. This mismatch will cause runtime errors. Change enumName to 'form_submission_grouping_types'.
| enumName: "FormSubmissionGrouping", | |
| enumName: "form_submission_grouping_types", |
| }) | ||
| formSubmission: FormSubmission; | ||
| /** | ||
| *Dynamic form configuration used to render and validate this item. |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after asterisk at the beginning of the JSDoc comment. The comment should start with a space after the asterisk to follow proper JSDoc formatting conventions.
| COMMENT ON COLUMN sims.form_submission_items.modifier IS 'User ID of the last user who modified the record.'; | ||
|
|
||
| -- Constraints comments. | ||
| COMMENT ON CONSTRAINT form_submission_items_decision_fields_required_constraint ON sims.form_submission_items IS 'Requires decision_date, decision_by, and decision_note_id when submission_status is not pending.'; No newline at end of file |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constraint comment incorrectly refers to 'submission_status' but the actual column being checked is 'decision_status'. This is misleading and should reference the correct column name to match the constraint definition on lines 16-26.
| COMMENT ON CONSTRAINT form_submission_items_decision_fields_required_constraint ON sims.form_submission_items IS 'Requires decision_date, decision_by, and decision_note_id when submission_status is not pending.'; | |
| COMMENT ON CONSTRAINT form_submission_items_decision_fields_required_constraint ON sims.form_submission_items IS 'Requires decision_date, decision_by, and decision_note_id when decision_status is not pending.'; |
| export * from "./form-submission-grouping.type"; | ||
| export * from "./form-category.type"; | ||
| export * from "./form-submission-status.type"; | ||
| export * from "./form-submission.model"; |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FormSubmissionDecisionStatus enum is not exported from the index.ts file. This enum is used by FormSubmissionItem and should be exported to make it available for use in other parts of the application.
| export * from "./form-submission.model"; | |
| export * from "./form-submission.model"; | |
| export * from "./form-submission-decision-status.type"; |
|


PR to support the initial analisys for the new DB structure.