Skip to content

Commit 514401b

Browse files
committed
chore: add storage and db init script
1 parent e8038ee commit 514401b

File tree

2 files changed

+55
-13
lines changed

2 files changed

+55
-13
lines changed

.fly/scripts/1_storage_init.sh

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,56 @@
1-
FOLDER=/var/www/html/storage/app
2-
if [ ! -d "$FOLDER" ]; then
3-
echo "$FOLDER is not a directory, copying storage_ content to storage"
4-
cp -r /var/www/html/storage_/. /var/www/html/storage
5-
echo "deleting storage_..."
6-
rm -rf /var/www/html/storage_
1+
#!/bin/bash
2+
3+
# Ensure the storage folder has the correct structure
4+
STORAGE_PATH=/var/www/html/storage
5+
STORAGE_BACKUP_PATH=/var/www/html/storage_
6+
7+
if [ ! -d "$STORAGE_PATH/app" ]; then
8+
echo "$STORAGE_PATH/app is not a directory, copying content from $STORAGE_BACKUP_PATH to $STORAGE_PATH"
9+
cp -r $STORAGE_BACKUP_PATH/. $STORAGE_PATH
10+
echo "Deleting $STORAGE_BACKUP_PATH..."
11+
rm -rf $STORAGE_BACKUP_PATH
712
fi
13+
14+
# Ensure the database folder and SQLite file exist
15+
DB_FOLDER=$STORAGE_PATH/database
16+
DB_FILE=$DB_FOLDER/database.sqlite
17+
18+
if [ ! -d "$DB_FOLDER" ]; then
19+
echo "$DB_FOLDER does not exist, initializing database folder"
20+
mkdir -p $DB_FOLDER
21+
fi
22+
23+
if [ ! -f "$DB_FILE" ]; then
24+
echo "$DB_FILE not found, creating SQLite database"
25+
touch $DB_FILE
26+
fi
27+
28+
echo "Script execution completed."
29+
#!/bin/bash
30+
31+
# Ensure the storage folder has the correct structure
32+
STORAGE_PATH=/var/www/html/storage
33+
STORAGE_BACKUP_PATH=/var/www/html/storage_
34+
35+
if [ ! -d "$STORAGE_PATH/app" ]; then
36+
echo "$STORAGE_PATH/app is not a directory, copying content from $STORAGE_BACKUP_PATH to $STORAGE_PATH"
37+
cp -r $STORAGE_BACKUP_PATH/. $STORAGE_PATH
38+
echo "Deleting $STORAGE_BACKUP_PATH..."
39+
rm -rf $STORAGE_BACKUP_PATH
40+
fi
41+
42+
# Ensure the database folder and SQLite file exist
43+
DB_FOLDER=$STORAGE_PATH/database
44+
DB_FILE=$DB_FOLDER/database.sqlite
45+
46+
if [ ! -d "$DB_FOLDER" ]; then
47+
echo "$DB_FOLDER does not exist, initializing database folder"
48+
mkdir -p $DB_FOLDER
49+
fi
50+
51+
if [ ! -f "$DB_FILE" ]; then
52+
echo "$DB_FILE not found, creating SQLite database"
53+
touch $DB_FILE
54+
fi
55+
56+
echo "Script execution completed."

.fly/scripts/2_database_init.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)