From da419950cef143ac949e8de8721771e6e182056c Mon Sep 17 00:00:00 2001 From: "sas.fajri" Date: Tue, 5 May 2026 09:06:49 +0700 Subject: [PATCH] Add participant daily details migration and naming rules --- AGENTS.md | 29 +++++++++++ clude.md | 50 +++++++++++++++++++ ...3_create_mcu_participant_daily_details.sql | 14 ++++++ 3 files changed, 93 insertions(+) create mode 100644 AGENTS.md create mode 100644 clude.md create mode 100644 cpone-dashboard/db/migrations/013_create_mcu_participant_daily_details.sql diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..d776993 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,29 @@ +# AGENTS.md instructions for /Users/fajrihardhitamurti/REPO_CPONE_DASHBOARD + +Kamu adalah teman fajri dalam ngoding, trading saham/crypto, dan urusan teknis harian. Fokus: cepat, tepat, tidak ngarang. + +## Aturan commit/push +- Kalau diminta `commit` dan `push`, lakukan inspeksi seminimal mungkin. +- Saat menyiapkan commit/push, cek dulu: + - `git status` + - `git diff --stat` +- Buat commit message singkat dan langsung `git push`. +- Jangan tambah kerja tambahan yang tidak diminta user. + +## Aturan penamaan table/kolom (cpone_dashboard) +- Nama table wajib `snake_case` lowercase, contoh: `mcu_participant_daily_details`. +- Nama kolom wajib pakai prefix entitas/tabel, jangan pakai nama generik tanpa prefix. +- Untuk table `mcu_participant_daily_details`, gunakan pola kolom: + - `Mcu_ParticipantDailyDetailsID` + - `Mcu_ParticipantDailyDetailsParticipantDailyID` + - `Mcu_ParticipantDailyDetailsMcu_PatientID` + - `Mcu_ParticipantDailyDetailsIsActive` + - `Mcu_ParticipantDailyDetailsCreated` + - `Mcu_ParticipantDailyDetailsLastUpdated` +- Standar default kolom: + - `...IsActive CHAR(1) NOT NULL DEFAULT 'Y'` + - `...Created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP` + - `...LastUpdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP` +- Engine/charset standar: + - `ENGINE=InnoDB` + - `DEFAULT CHARSET=utf8mb4` diff --git a/clude.md b/clude.md new file mode 100644 index 0000000..12a63d1 --- /dev/null +++ b/clude.md @@ -0,0 +1,50 @@ +# Aturan Penulisan Table dan Kolom (cpone_dashboard) + +## 1) Penamaan Table +- Gunakan `snake_case` semua huruf kecil. +- Gunakan prefix domain bila relevan: `mcu_...`, `dashboard_...`, `published_...`. +- Nama table harus deskriptif dan konsisten dengan modul data. +- Contoh benar: + - `mcu_participant_daily` + - `mcu_participant_daily_details` + - `mcu_patient_resume_status` + +## 2) Penamaan Kolom +- Gunakan `PascalCase` dengan prefix entitas/tabel. +- Pola utama: + - `ID` untuk primary key. + - `` untuk field lain. +- Hindari nama generik tanpa prefix seperti `IsActive`, `Created`, `LastUpdated`. +- Contoh benar (table: `mcu_participant_daily_details`): + - `Mcu_ParticipantDailyDetailsID` + - `Mcu_ParticipantDailyDetailsParticipantDailyID` + - `Mcu_ParticipantDailyDetailsMcu_PatientID` + - `Mcu_ParticipantDailyDetailsIsActive` + - `Mcu_ParticipantDailyDetailsCreated` + - `Mcu_ParticipantDailyDetailsLastUpdated` + +## 3) Kolom Status & Waktu (Standar) +- Status aktif: + - `...IsActive CHAR(1) NOT NULL DEFAULT 'Y'`. +- Waktu buat: + - `...Created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP`. +- Waktu update terakhir: + - `...LastUpdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP`. + +## 4) Key dan Index +- Primary key wajib pada kolom `...ID`. +- Tambahkan index pada kolom relasi/filter utama. +- Nama index gunakan pola jelas: + - `idx_` untuk index biasa. + - `uq_` / `uk_` untuk unique key. + +## 5) Charset/Engine +- Gunakan: + - `ENGINE=InnoDB` + - `DEFAULT CHARSET=utf8mb4` + +## 6) Checklist Sebelum Buat Migration Baru +- Pastikan nama table `snake_case`. +- Pastikan semua kolom pakai prefix entitas (bukan nama generik). +- Pastikan kolom ID, IsActive, Created, LastUpdated mengikuti standar. +- Tambahkan index minimal untuk kolom relasi dan kolom filter utama. diff --git a/cpone-dashboard/db/migrations/013_create_mcu_participant_daily_details.sql b/cpone-dashboard/db/migrations/013_create_mcu_participant_daily_details.sql new file mode 100644 index 0000000..555835a --- /dev/null +++ b/cpone-dashboard/db/migrations/013_create_mcu_participant_daily_details.sql @@ -0,0 +1,14 @@ +-- Migration 013: create mcu_participant_daily_details + +CREATE TABLE IF NOT EXISTS mcu_participant_daily_details ( + Mcu_ParticipantDailyDetailsID INT NOT NULL AUTO_INCREMENT, + Mcu_ParticipantDailyDetailsParticipantDailyID INT NOT NULL, + Mcu_ParticipantDailyDetailsMcu_PatientID INT NOT NULL, + Mcu_ParticipantDailyDetailsIsActive CHAR(1) NOT NULL DEFAULT 'Y', + Mcu_ParticipantDailyDetailsCreated DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + Mcu_ParticipantDailyDetailsLastUpdated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (Mcu_ParticipantDailyDetailsID), + KEY idx_participant_daily_id (Mcu_ParticipantDailyDetailsParticipantDailyID), + KEY idx_patient_id (Mcu_ParticipantDailyDetailsMcu_PatientID), + KEY idx_active (Mcu_ParticipantDailyDetailsIsActive) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;