Skip to content

feat: MySQL / MariaDB projection target for zamsync project #55

Description

@Etoile-Bleu

Summary

Add a MySQL / MariaDB backend to zamsync project so events can be projected to mysql:// targets using INSERT IGNORE INTO.

Context and motivation

Several hospital information systems in low-resource settings (OpenMRS, DHIS2) use MySQL or MariaDB as their primary database. A native mysql:// projection target avoids an extra ETL hop.

Exact task

Follow the same pattern as the planned PostgreSQL target (see #related):

  1. Add sqlx with mysql feature to Cargo.toml (if not already present from the PG issue)
  2. Create src/cmd/project_mysql.rs with INSERT IGNORE INTO zamsync_events (...) VALUES (...)
  3. Table DDL mirrors the SQLite schema with MySQL types (BIGINT UNSIGNED, LONGBLOB for payload)
  4. Dispatch in src/cmd/project.rs: if --target starts with mysql://, call project_mysql::run()
  5. Integration test gated on TEST_MYSQL_URL env var; skip if unset

Acceptance criteria

  • zamsync project <dir> --target mysql://root@localhost/zamsync works end-to-end
  • Idempotent: second run inserts 0 rows
  • Test skips gracefully when TEST_MYSQL_URL is unset

Estimated effort

~2-4 h -- medium (new flag or filter, integration test)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions