Mocking MySQL SET and ENUM Types for Local Environments
The only synthetic data generator combining industry standards for research, clinical operations, and pharmaceutical testing
If you use MySQL or MariaDB, you likely rely on ENUM and SET data types to enforce strict data constraints at the database level. ENUM restricts a column to a single value from a predefined list, while SET allows multiple values from a list.
While great for data integrity, these types are a nightmare for database seeding. Here is why generic mocking tools crash against MySQL's strictest data types, and how to use Aphelion to generate thousands of valid, constraint-safe rows in seconds.
The Code Problem: The Allowed Values Trap
Look at a standard user permissions schema in MySQL:
CREATE TABLE user_profiles (
user_id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50),
-- ENUM: Must be exactly one of these strings
account_status ENUM('active', 'suspended', 'pending_verification') NOT NULL,
-- SET: Can be zero, one, or multiple of these strings
notification_prefs SET('email', 'sms', 'push', 'weekly_digest') NOT NULL
);
Why Faker.js and Custom Scripts Fail
If you point a generic SQL seeder or Faker.js at this schema, it will fail instantly:
- Unrecognized Types: Generic tools see ENUM and SET as basic strings. They will attempt to insert a random string like "Lorem Ipsum" into account_status.
- Data Truncation Errors: MySQL strictly enforces the allowed list. Inserting an invalid string throws ERROR 1265 (01000): Data truncated for column 'account_status', immediately halting your CI/CD pipeline or local seeding script.
- Complex SET Logic: Generating valid SET data requires combining strings with commas (e.g., 'email,push'). Basic scripts simply don't know how to construct valid subsets from the schema definition.
The Aphelion Solution
Aphelion is a Rust-native synthetic data generator that natively understands MySQL and MariaDB dialect specifics.
Instead of guessing, Aphelion automatically parses the database schema, extracts the exact strings defined inside the ENUM and SET columns, and randomly selects valid combinations during generation.
Recipe: Seeding MySQL ENUM and SET Types
# 1. Point Aphelion at your local MySQL database
aphelion introspect mysql://root:password@localhost:3306/app_db
# 2. Generate 10,000 constraint-safe users
aphelion generate --table user_profiles --rows 10000 --seed 2026
Result: Aphelion automatically extracts ('active', 'suspended', 'pending_verification') and generates perfectly valid rows. No truncation errors, no fragile custom arrays in your test scripts
Tags: #Healthcare #OMOP #OpenMRS #SyntheticData #FHIR #HIPAA #DataGeneration
Ready for Verifiable Synthetic Data?
Discover how CausalFoundry manufactures high-integrity datasets that obey your complex business rules.
Explore CausalFoundry