← Back to directory

Turn MySQL CREATE TABLE statements into a PostgreSQL schema and migration plan: ...

https://code.halowerk.com/v1/mysql-to-pg-plan

Overview

Turn MySQL CREATE TABLE statements into a PostgreSQL schema and migration plan: documented type mapping, identities, enums, sets, zero dates, ON UPDATE triggers, indexes, foreign keys and load conversions.

Protocol x402 (POST)
Price $0.0040
Payment Asset USD Coin
Payment Network Base
Category uncategorized
Provider code
Source bazaar
Indexed 2026-11-20 13:10:04

Health

Status unknown
Latency (p50) —
Uptime (30d) —
Reliability Score —
Last Checked Never
Last Healthy Never
Consecutive Failures 0

x402 Payment Validation

Payment Requirements —
Asset Verified —
Facilitator —

Input Schema

{ "body": { "mysql_ddl": "CREATE TABLE `users` (`id` int unsigned NOT NULL AUTO_INCREMENT, `email` varchar(191) NOT NULL, `is_active` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;" }, "bodyType": "json", "method": "POST", "type": "http" }

Output Schema

{ "example": { "limitations": [ "Schema plan only: data, views, routines, triggers and partitions of MySQL are not converted.", "Collation and time-zone semantics differ between MySQL and PostgreSQL; test queries after migration." ], "result": { "postgres_ddl": "CREATE TABLE users (\n id bigint GENERATED BY DEFAULT AS IDENTITY,\n email varchar(191) NOT NULL,\n is_active boolean DEFAULT true NOT NULL,\n PRIMARY KEY (id)\n);\n", "steps": [ { "sql": [ "CREATE TABLE users (\n id bigint GENERATED BY DEFAULT AS IDENTITY,\n email varchar(191) NOT NULL,\n is_active boolean DEFAULT true NOT NULL,\n PRIMARY KEY (id)\n);" ], "step": 1, "title": "Create tables (primary keys only)" }, { "always": true, "conversions": [ { "column": "is_active", "conversion": "0 -> false, any other value -> true", "table": "users" } ], "note": "Load with pgloader or COPY; secondary indexes and foreign keys are added afterwards for speed.", "sql": [], "step": 2, "title": "Load data" }, { "sql": [ "SELECT setval(pg_get_serial_sequence('users', 'id'), COALESCE(MAX(id), 1), MAX(id) IS NOT NULL) FROM users;" ], "step": 3, "title": "Reset identity sequences" }, { "note": "Compare the row counts with SELECT COUNT(*) on MySQL.", "sql": [ "ANALYZE;", "SELECT count(*) FROM users;" ], "step": 4, "title": "Verify" } ], "summary": { "columns": 3, "enum_types": 0, "foreign_keys": 0, "indexes": 0, "skipped_statements": 0, "tables": 1, "triggers": 0 }, "tables": [ { "columns": [ { "checks": [], "column": "id", "default": null, "mysql_type": "int unsigned", "notes": [ "INT UNSIGNED reaches 4294967295, above PostgreSQL integer." ], "nullable": false, "postgres_type": "bigint GENERATED BY DEFAULT AS IDENTITY", "rule_source": "https://github.com/dimitri/pgloader/blob/231ab86778ca5ffd7de40878714760c8b4860cdf/docs/ref/mysql.rst#default-mysql-casting-rules" }, { "checks": [], "column": "email", "default": null, "mysql_type": "varchar(191)", "notes": [], "nullable": false, "postgres_type": "varchar(191)", "rule_source": "https://github.com/dimitri/pgloader/blob/231ab86778ca5ffd7de40878714760c8b4860cdf/docs/ref/mysql.rst#default-mysql-casting-rules" }, { "checks": [], "column": "is_active", "default": "true", "mysql_type": "tinyint(1)", "notes": [ "tinyint(1) is MySQL's BOOLEAN (pgloader rule \"tinyint when (= 1 precision) to boolean\"); values other than 0 and 1 become true." ], "nullable": false, "postgres_type": "boolean", "rule_source": "https://github.com/dimitri/pgloader/blob/231ab86778ca5ffd7de40878714760c8b4860cdf/docs/ref/mysql.rst#default-mysql-casting-rules" } ], "engine": "InnoDB", "indexes": [], "mysql_table": "users", "primary_key": [ "id" ], "table": "users" } ], "type_mappings": [ { "mysql": "int unsigned auto_increment", "postgres": "bigint GENERATED BY DEFAULT AS IDENTITY", "source": "https://github.com/dimitri/pgloader/blob/231ab86778ca5ffd7de40878714760c8b4860cdf/docs/ref/mysql.rst#default-mysql-casting-rules" }, { "mysql": "varchar(191)", "postgres": "varchar(191)", "source": "https://github.com/dimitri/pgloader/blob/231ab86778ca5ffd7de40878714760c8b4860cdf/docs/ref/mysql.rst#default-mysql-casting-rules" }, { "mysql": "tinyint(1)", "postgres": "boolean", "source": "https://github.com/dimitri/pgloader/blob/231ab86778ca5ffd7de40878714760c8b4860cdf/docs/ref/mysql.rst#default-mysql-casting-rules" } ], "warnings": [ "users: MySQL compares strings case-insensitively (default collation); PostgreSQL does not. Use citext, lower() indexes or a nondeterministic ICU collation where needed." ] }, "service": "mysql-to-pg-plan", "status": "success" }, "type": "json" }