Skip to content

Commit

Permalink
Improved documentation for database import process in bash script
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfelt committed Apr 27, 2013
1 parent 859c95d commit 635690d
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions database/import-sql.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
#!/bin/bash
#
# Import provided SQL files in to MySQL.
#
# The files in the {vvv-dir}/database/backups/ directory should be created by
# mysqldump or some other export process that generates a full set of SQL commands
# to create the necessary tables and data required by a database.
#
# For an import to work properly, the SQL file should be named `db_name.sql` in which
# `db_name` matches the name of a database already created in {vvv-dir}/database/init-custom.sql
# or {vvv-dir}/database/init.sql.
#
# If a filename does not match an existing database, it will not import correctly.
#
# If tables already exist for a database, the import will not be attempted again. After an
# initial import, the data will remain persistent and available to MySQL on future boots
# through {vvv-dir}/database/data
#
# Let's begin...

# Move into the newly mapped backups directory, where mysqldump(ed) SQL files are stored
cd /srv/database/backups/

printf "\nStart DB Import\n\n"
cd /srv/database/backups/ | printf "\nStart MySQL Database Import\n\n"

# Parse through each file in the directory and use the file name to
# import the SQL file into the database of the same name
Expand Down

0 comments on commit 635690d

Please sign in to comment.