Created
March 29, 2019 17:17
-
-
Save peteWT/f229d27875572b577cf301b05b08eb2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Inspired by | |
# https://www.codeenigma.com/community/blog/using-mdbtools-nix-convert-microsoft-access-mysql | |
# USAGE | |
# Rename your MDB file to migration-export.mdb | |
# run ./mdb2sqlite.sh migration-export.mdb | |
# wait and wait a bit longer... | |
mdb-schema migration-export.accdb sqlite > schema.sql | |
mkdir sqlite | |
mkdir sql | |
for i in $( mdb-tables migration-export.accdb ); do echo $i ; mdb-export -D "%Y-%m-%d %H:%M:%S" -H -I sqlite migration-export.accdb $i > sql/$i.sql; done | |
mv schema.sql sqlite | |
mv sql sqlite | |
cd sqlite | |
cat schema.sql | sqlite3 db.sqlite3 | |
for f in sql/* ; do echo $f && cat $f | sqlite3 db.sqlite3; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment