forked from aanoaa/Upload-Web
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yuni Kim
committed
Jul 4, 2011
1 parent
215ad6d
commit 61ea08c
Showing
1 changed file
with
13 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
#!/bin/sh | ||
|
||
DB_SQL=db/init.sql | ||
DB_FILE=db/upload.db | ||
|
||
if [ -e ./db ]; then | ||
echo Creating $DB_FILE... | ||
if [ -e $DB_FILE ]; then | ||
echo $DB_FILE is already exists. | ||
echo Usage : script/init_db.sh | ||
exit | ||
fi | ||
|
||
if [ -e $DB_FILE ]; then | ||
echo $DB_FILE is already exists. | ||
else | ||
sqlite3 $DB_FILE <<__SQL__ | ||
CREATE TABLE upload ( | ||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
md5 TEXT NOT NULL, | ||
fname TEXT NOT NULL, | ||
download INTEGER NOT NULL DEFAULT 0 | ||
); | ||
__SQL__ | ||
echo Done. | ||
fi | ||
else | ||
if [ ! -e $DB_SQL ]; then | ||
echo $DB_SQL is not exists. | ||
echo Usage : script/init_db.sh | ||
exit | ||
fi | ||
|
||
echo Creating $DB_FILE... | ||
cat $DB_SQL | sqlite3 $DB_FILE | ||
echo Done. |