{"id":43281,"library":"mysql-extractor","title":"mysql-extractor","description":"Node.js package (v0.4.4) that extracts a MySQL database schema into JSON files for tables, foreign keys, indexes, and issues. Designed to facilitate migrations by outputting structured schema representations, including column types, constraints, and known naming/type issues. The library supports a range of MySQL column types and provides filtering options via callback. It offers minimal dependencies and a straightforward API. Development appears to be in maintenance mode with no recent updates.","status":"maintenance","version":"0.4.4","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","mysql","database","extract","schema","db","migration"],"install":[{"cmd":"npm install mysql-extractor","lang":"bash","label":"npm"},{"cmd":"yarn add mysql-extractor","lang":"bash","label":"yarn"},{"cmd":"pnpm add mysql-extractor","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"The mysql npm package is required to connect to and query the MySQL database.","package":"mysql","optional":false}],"imports":[{"note":"CommonJS only; no ESM support.","wrong":"import MySqlExtractor from 'mysql-extractor';","symbol":"MySqlExtractor","correct":"const MySqlExtractor = require('mysql-extractor');"},{"note":"Default export is a constructor. No named exports available.","symbol":"MySqlExtractor","correct":"const MySqlExtractor = require('mysql-extractor');"}],"quickstart":{"code":"const MySqlExtractor = require('mysql-extractor');\nconst opts = {\n  host: process.env.MYSQL_HOST ?? 'localhost',\n  user: process.env.MYSQL_USER ?? 'root',\n  password: process.env.MYSQL_PASSWORD ?? '',\n  database: process.env.MYSQL_DATABASE ?? 'test',\n  tableFile: 'tables.json',\n  keyFile: 'keys.json',\n  indexFile: 'indexes.json',\n  issueFile: 'issues.json',\n  issues: [\n    'one_key_error',\n    'integer_primary_error',\n    'unsigned_primary_error',\n    'unique_primary_error',\n    'incrementing_primary_warning',\n    'id_primary_warning',\n    'reference_integer_foreign_error',\n    'reference_unsigned_foreign_error',\n    'reference_unique_foreign_error',\n    'integer_foreign_error',\n    'unsigned_foreign_error',\n    'index_foreign_warning',\n    'foreign_to_id_warning',\n    'reference_primary_foreign_warning',\n    'column_lowercase_warning'\n  ],\n  filterTableNames: function (tableNames) {\n    return tableNames.filter(function (tableName) { return true; });\n  }\n};\nconst extractor = new MySqlExtractor(opts);\nextractor.createTableFile();\nextractor.createForeignKeyFile();\nextractor.createIndexFile();\nextractor.createIssueFile();","lang":"javascript","description":"Connects to a MySQL database, extracts schema info, and writes JSON files for tables, keys, indexes, and issues."},"warnings":[{"fix":"Consider migrating to 'mysql2' for better security and features. The package itself may need to be forked or replaced.","message":"The package uses an outdated 'mysql' driver which is deprecated and has no modern authentication support.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Wrap calls in a synchronous context or use a different library that supports promises.","message":"The package does not support promise-based or async/await workflows; all methods are synchronous.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Create custom .d.ts or use // @ts-ignore.","message":"No TypeScript type definitions are provided.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Replace dependency with 'mysql2' and adjust the connection options accordingly.","message":"The npm 'mysql' driver is deprecated; the maintainer recommends using 'mysql2' instead.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'api':62 'appear':64 'callback':54 'column':33,47 'constraint':35 'databas':11,76 'db':79 'depend':58 'design':23 'develop':63 'extract':8,77 'extractor':3 'facilit':25 'file':15 'filter':51 'foreign':18 'includ':32 'index':20 'issu':22,39 'javascript':74 'json':14 'key':19 'known':37 'librari':41 'mainten':68 'migrat':26,80 'minim':57 'mode':69 'mysql':2,10,46,75 'mysql-extractor':1 'naming/type':38 'node.js':4 'offer':56 'option':52 'output':28 'packag':5 'provid':50 'rang':44 'recent':72 'represent':31 'schema':12,30,78 'straightforward':61 'structur':29 'support':42 'tabl':17 'type':34,48 'updat':73 'v0.4.4':6 'via':53","created_at":"2026-06-05T16:59:03.073612+00:00","updated_at":"2026-06-05T16:59:03.073612+00:00","problems":[{"fix":"Run: npm install mysql","cause":"The mysql driver is a peer dependency that must be manually installed.","error":"Error: Cannot find module 'mysql'"},{"fix":"Use: const MySqlExtractor = require('mysql-extractor');","cause":"Using incorrect import: attempted named import instead of default require.","error":"TypeError: MySqlExtractor is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"mysql-extractor","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}