How github/skeema works
Project type and purpose
• This is an open-source command-line tool (“Skeema”) for declaratively managing MySQL schemas.
• The README describes its role: exporting CREATE TABLE statements, diffing live schemas vs. repo, linting, and pushing ALTER statements (optionally via online schema-change tools).
File structure
• Top-level CLI entrypoints:
• skeema.go – initializes the CLI
• cmd_*.go – handlers for subcommands (diff, pull, push, init, lint, format, add-env, etc.)
• Core subpackages:
• util – config loader, caching, shell-out wrapper
• fs – filesystem abstraction for discovering/managing .skeema files and .sql files
• dumper – logic to connect to a live MySQL instance and export CREATE statements to disk
• linter – rules engine to validate SQL schemas against best practices
• applier – generates and applies DDL ALTER statements to live databases
• workspace – isolated temporary schemas for safe diffing/applying
• External integration points:
• MySQL servers (various versions)
• Optional online-schema-change CLI tools (e.g., pt-online-schema-change)
• Filesystem (git repo, local disk)
• Configuration files: .skeema files in directory tree; goreleaser/travis for CI; vendor for dependencies.
Key insights from the README
• Declarative workflow: schemas live in filesystem; CLI syncs repo ↔ live DBs
• Multi-environment management: dev, staging, prod targets
• Pull-request based workflow and optional CI integration