Created
November 14, 2013 17:02
-
-
Save psema4/7470381 to your computer and use it in GitHub Desktop.
A simple utility to read all .sql files in the current directory, create an in-memory database from them and start a sqlite3 shell
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
#!/usr/bin/env bash | |
# A simple utility to read all .sql files in the current directory, create an | |
# in-memory database from them and start a sqlite3 shell | |
if [ -f mini.db ]; then | |
echo "found existing database, removing" | |
rm mini.db; | |
fi | |
cat ./*.sql | sqlite3 mini.db -init - && sqlite3 mini.db | |
# cleanup | |
if [ -f mini.db ]; then | |
rm mini.db; | |
fi | |
echo "done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment