Files
peptide-repo-core/includes/migrations/class-pr-core-migration-0001-dosing-rows.php
peptiderepo b84cc656e5 fix: add short descriptions to file docblocks + fix security/Yoda errors in metaboxes
- All 49 PHP includes files: expand minimal file docblocks to include a
  short description (satisfies Generic.Commenting.DocComment.MissingShort)
  Format: <?php\n/**\n * Filename-derived description.\n *\n * @package ...\n */
- settings.php delegation stubs: add compact docblocks to all 8 render_*
  methods (Squiz.Commenting.FunctionComment.Missing, lines 93-231)
- settings.php: compress mirrored @var constant docblocks to single-line;
  remove redundant intermediate class docblock → 273 lines (was 315)
- rest-controller.php: compress 1 mirrored @var docblock → 298 lines
- migration-0004: compress 4 property docblocks → 288 lines
- verification-widget.php line 111: cast days_since to int + phpcs:ignore
- verification-metabox.php line 80: phpcs:ignore on hardcoded badge_class
- peptide-metaboxes.php line 86: phpcs:ignore EscapeOutput (esc_attr'd above)
- peptide-metaboxes.php lines 147/148: Yoda null !== dose_min/dose_max
- peptide-metaboxes.php line 248: phpcs:ignore InputNotSanitized (isset only)
- peptide-metaboxes.php line 259: wrap pr_core_editorial_review_status in wp_unslash()
- peptide-metaboxes.php line 262: Yoda 'published' !== old_status

Agent-Session: claude-adopt-ci-20260616
2026-06-16 16:12:25 +00:00

76 lines
2.2 KiB
PHP

<?php
/**
* Migration 0001 Dosing Rows.
*
* @package Peptide_Repo_Core
*/
declare(strict_types=1);
/**
* Creates the high-cardinality dosing data table (1:many with peptide)
*
* @package Peptide_Repo_Core
*/
/**
* Migration 0001: Create the pr_dosing_rows table.
*
* What: Creates the high-cardinality dosing data table (1:many with peptide).
* Who calls it: PR_Core_Migration_Runner::run_pending().
* Dependencies: WordPress $wpdb, dbDelta().
*
* @see ARCHITECTURE.md — Table schema specification.
*/
class PR_Core_Migration_0001_Dosing_Rows {
/**
* Create the pr_dosing_rows table.
*
* Side effects: database DDL via dbDelta().
*
* @return void
*/
public function up(): void {
global $wpdb;
$table = $wpdb->prefix . 'pr_dosing_rows';
$charset = $wpdb->get_charset_collate();
$sql = "CREATE TABLE {$table} (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
peptide_id BIGINT UNSIGNED NOT NULL,
dose_min DECIMAL(12,4) NULL,
dose_max DECIMAL(12,4) NULL,
dose_unit VARCHAR(16) NOT NULL,
route VARCHAR(32) NOT NULL,
frequency VARCHAR(64) NULL,
duration_value INT UNSIGNED NULL,
duration_unit VARCHAR(16) NULL,
population VARCHAR(32) NOT NULL,
indication VARCHAR(255) NULL,
evidence_strength VARCHAR(32) NOT NULL,
study_title VARCHAR(500) NULL,
study_year SMALLINT UNSIGNED NULL,
citation_pubmed_id VARCHAR(16) NULL,
citation_doi VARCHAR(128) NULL,
citation_url VARCHAR(500) NULL,
notes TEXT NULL,
schema_version SMALLINT UNSIGNED NOT NULL DEFAULT 1,
source VARCHAR(32) NOT NULL DEFAULT 'manual',
ai_candidate_id BIGINT UNSIGNED NULL,
added_by BIGINT UNSIGNED NOT NULL,
added_at DATETIME NOT NULL,
reviewed_by BIGINT UNSIGNED NULL,
reviewed_at DATETIME NULL,
superseded_by_id BIGINT UNSIGNED NULL,
PRIMARY KEY (id),
KEY idx_peptide (peptide_id),
KEY idx_peptide_route (peptide_id, route),
KEY idx_peptide_population (peptide_id, population),
KEY idx_pubmed (citation_pubmed_id)
) {$charset};";
dbDelta( $sql );
}
}