File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # User config
4+ read -p " Database name [shika]: " dataname
5+ if [ -z $dataname ]
6+ then
7+ dataname=shika
8+ fi
9+ read -p " Database username [admin]: " username
10+ if [ -z $username ]
11+ then
12+ username=admin
13+ fi
14+ while [ -z $password ]
15+ do
16+ read -p " Database password: " password
17+ done
18+ while true ; do
19+ read -p " Choose a database 1: MySQL, 2: SQLite [2] " database
20+ case $database in
21+ " 1" ) break ;;
22+ " 2" ) break ;;
23+ " " ) database=" 2" ; break ;;
24+ * ) echo " Invalid choice" ;;
25+ esac
26+ done
27+
28+ echo " "
29+ while true ; do
30+ read -p read -p " Your selection: $dataname $username $password $database , y to continue [y] " confirm
31+ case $confirm in
32+ [yY]* ) break ;;
33+ " " ) break ;;
34+ * ) echo " Invalid choice" ;;
35+ esac
36+ done
37+
38+ path=$( dirname $( realpath $0 ) )
39+ echo " "
40+ if [ $database == " 1" ]
41+ then
42+ echo -e " DB_DSN=mysql:host=localhost;dbname=$dataname \nDB_USERNAME=$username \nDB_PASSWORD=$password " > .env
43+ elif [ $database == " 1" ]
44+ then
45+ echo -e " DB_DSN=sqlite:$path /$dataname .sqlite\nDB_USERNAME=$username \nDB_PASSWORD=$password " > .env
46+ fi
47+ echo " .env config created at $path /.env"
48+
49+ php bin/migrate
You can’t perform that action at this time.
0 commit comments