I needed to convert a database schema from MySQL to SQLite and found a great tool for doing such schema conversion jobs.
# install sqlt on debian sytems with:
sudo apt-get install sqlfairy
# convert from one schema to another schema with:
sqlt -f DBI --dsn dbi:mysql:dbname --db-user root -t SQLite > sqlite.sql
The above command connects to mysql and reads the mysql schema from the connection and writes the sqlite schema to sqlite.sql. You can easily change this command for other databases. If you want to know if sqlt supports your conversion you can run:
sqlt -l
Parsers:
Access
DB2
DB2-Grammar
DBI
DBI-DB2
DBI-MySQL
DBI-PostgreSQL
DBI-SQLite
DBI-Sybase
Excel
MySQL
Oracle
PostgreSQL
SQLite
Storable
Sybase
XML
XML-SQLFairy
YAML
xSV
Producers:
ClassDBI
Diagram
Dumper
GraphViz
HTML
MySQL
Oracle
POD
PostgreSQL
SQLServer
SQLite
Storable
Sybase
TT-Base
TT-Table
TTSchema
XML
XML-SQLFairy
YAML
The Parsers are needed to read the schema and the Producers are needed to write the schema.
Linkshttp://sqlfairy.sourceforge.net/Labels: Conversion, Schema, sql, SQLFairy, SQLite, sqlite3