Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
USE db_iemr;
CREATE TABLE IF NOT EXISTS `t_hbyc_child_visits` (
`id` bigint NOT NULL AUTO_INCREMENT,
`beneficiary_id` bigint DEFAULT NULL,
`household_id` bigint DEFAULT NULL,
`visit_day` varchar(50) DEFAULT NULL,
`user_id` int DEFAULT NULL,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion | 🟠 Major

Use bigint for user_id to match other ID columns.

The user_id column uses int while beneficiary_id and household_id use bigint. This type inconsistency could cause issues if the user ID space grows beyond the int range (2,147,483,647) and creates unnecessary type coercion in joins.

πŸ”§ Recommended fix
-   `user_id` int DEFAULT NULL,
+   `user_id` bigint DEFAULT NULL,
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
`user_id` int DEFAULT NULL,
`user_id` bigint DEFAULT NULL,
πŸ€– Prompt for AI Agents
In @src/main/resources/db/migration/dbiemr/V36__DB_IEMR_hbyc_table_changes.sql
at line 7, The migration defines `user_id` as int while `beneficiary_id` and
`household_id` are bigint; change the `user_id` column definition in the V36
migration from "int DEFAULT NULL" to "bigint DEFAULT NULL" so types match, and
update any related indexes, foreign keys or ALTER statements in the same
migration that reference `user_id` to use bigint as well to avoid type
mismatches during joins or constraints.

`hbyc_due_date` DATE DEFAULT NULL,
`hbyc_visit_date` DATE DEFAULT NULL,
`is_baby_alive` tinyint(1) DEFAULT 1,
`date_of_death` DATE DEFAULT NULL,
`reason_for_death` varchar(255) DEFAULT NULL,
`place_of_death` varchar(255) DEFAULT NULL,
`other_place_of_death` varchar(255) DEFAULT NULL,
`baby_weight` decimal(4,2) DEFAULT NULL,
`is_child_sick` tinyint(1) DEFAULT NULL,
`is_exclusive_breastfeeding` tinyint(1) DEFAULT NULL,
`is_mother_counseled_exbf` tinyint(1) DEFAULT NULL,
`has_child_started_complementary_feeding` tinyint(1) DEFAULT NULL,
`is_mother_counseled_cf` tinyint(1) DEFAULT NULL,
`is_weight_recorded_by_aww` tinyint(1) DEFAULT NULL,
`is_developmental_delay` tinyint(1) DEFAULT NULL,
`is_measles_vaccine_given` tinyint(1) DEFAULT NULL,
`is_vitamin_a_given` tinyint(1) DEFAULT NULL,
`is_ors_available` tinyint(1) DEFAULT NULL,
`is_ifa_syrup_available` tinyint(1) DEFAULT NULL,
`is_ors_given` tinyint(1) DEFAULT NULL,
`is_ifa_syrup_given` tinyint(1) DEFAULT NULL,
`is_handwashing_counseling_given` tinyint(1) DEFAULT NULL,
`is_parenting_counseling_given` tinyint(1) DEFAULT NULL,
`is_family_planning_counseling_given` tinyint(1) DEFAULT NULL,
`diarrhoea_episode` tinyint(1) DEFAULT NULL,
`pneumonia_symptoms` tinyint(1) DEFAULT NULL,
`temperature` decimal(4,2) DEFAULT NULL,
`mcp_card_images` json DEFAULT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`created_by` varchar(100) DEFAULT NULL,
`is_breathing_difficulty` tinyint(1) DEFAULT NULL,
`is_complementary_feeding` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Loading