#!/usr/bin/env bash
set -e


##########################################################################################
#########
######### Setup Mysql
#########
##########################################################################################

mysql --version
mysql -e "SET GLOBAL innodb_file_format=Barracuda;"
mysql -e "SET GLOBAL innodb_large_prefix=1;"
mysql -e "CREATE DATABASE coreshop_test CHARSET=utf8mb4;"

##########################################################################################
#########
#########  add config templates
#########
##########################################################################################
mkdir -p $CS_HOME/var/config
cp app/config/parameters.example.yml app/config/parameters.yml


##########################################################################################
#########
#########  Install composer dependencies
#########
##########################################################################################
composer config minimum-stability dev
composer config prefer-stable true
COMPOSER_MEMORY_LIMIT=-1 composer req pimcore/pimcore:$PIMCORE_VERSION --no-interaction --no-scripts --no-update
COMPOSER_MEMORY_LIMIT=-1 composer install -o --no-interaction

##########################################################################################
#########
#########  Install composer dependencies
#########
##########################################################################################
bin/console cache:clear
bin/console assets:install --symlink web
