Skip to content

knwoop/schemaloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

schemaloader

A command-line tool to export MySQL database schema into SQL files.

Usage

Basic usage:

schemaloader load -h hostname -P port -u username -p password -db database_name -out /path/to/schema.sql

Command Line Options

Option Description Default
-h MySQL host localhost
-P MySQL port 3306
-u MySQL username (required)
-p MySQL password (required)
-db Database name (required)
-out Output file path schema.sql
-print Output as standard output false

Example

schemaloader load -h localhost -P 3306 -u root -p mypassword -db myapp -out dump/schema.sql

Output Format

The generated schema.sql file includes:

-- Generated by schemaloader on 2024-11-10 15:04:05
-- Database: myapp
-- Host: localhost:3306

SET FOREIGN_KEY_CHECKS=0;

-- Table definitions
DROP TABLE IF EXISTS `table_name`;
CREATE TABLE `table_name` (
  -- column definitions
  -- indexes
  -- foreign keys
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

SET FOREIGN_KEY_CHECKS=1;

License

This project is licensed under the MIT License - see the LICENSE file for details.

Authors

  • Kenta Takahashi (@knwoop)

About

generate schema.sql from MySQL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages