Skip to content

Instantly share code, notes, and snippets.

@ptflp
Last active March 15, 2018 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptflp/4d4cb63b52b61f2a02b68b9b429b4e94 to your computer and use it in GitHub Desktop.
Save ptflp/4d4cb63b52b61f2a02b68b9b429b4e94 to your computer and use it in GitHub Desktop.
migration for dektrium/yii2-user
#!/bin/bash
read -p "Type ip/host MySQL database: " -r
export hostdb=$REPLY;
read -p "Type MySQL database name: " -r
export dbname=$REPLY;
read -p "Type user of MySQL database: " -r
export userdb=$REPLY;
read -p "Type password of MySQL database: " -r
export passdb=$REPLY;
composer create-project --prefer-dist yiisoft/yii2-app-advanced web
cd web
./init --env=Development --overwrite=All
sed -i "s/mysql:host=localhost;dbname=yii2advanced/mysql:host=${hostdb};dbname=${dbname}/" common/config/main-local.php;
sed -i "s/'username' => 'root'/'username' => '${userdb}'/" common/config/main-local.php;
sed -i "s/'password' => ''/'password' => '${passdb}'/" common/config/main-local.php;
url=https://gist.githubusercontent.com/ptflp/4d4cb63b52b61f2a02b68b9b429b4e94/raw/7ebd54bd0923f7ea8287be2350c8bc0c6f828a1e/yii2-user.sh
filename=$(basename "$url")
wget "$url"
chmod +x $filename
./$filename
rm -f $filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment