This commit is contained in:
Laurent Destailleur 2023-06-22 21:53:12 +02:00
parent bcdddc2c1c
commit 4d5c88f5f1
3 changed files with 11 additions and 7 deletions

View File

@ -118,7 +118,7 @@ jobs:
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "SHOW DATABASES"
echo "Drop and create database"
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'DROP DATABASE IF EXISTS travis;'
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8';'
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8';"
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "CREATE USER 'travis'@'127.0.0.1' IDENTIFIED BY 'password';"
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'FLUSH PRIVILEGES;'

View File

@ -96,7 +96,7 @@ jobs:
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "SHOW DATABASES"
echo "Drop and create database"
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'DROP DATABASE IF EXISTS travis;'
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8';'
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8';"
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e "CREATE USER 'travis'@'127.0.0.1' IDENTIFIED BY 'password';"
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
mysql --host 127.0.0.1 --port 32574 -uroot -ppassword -e 'FLUSH PRIVILEGES;'

View File

@ -224,11 +224,15 @@ before_script:
- |
echo "Setting up database"
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
echo "MySQL"
echo "MySQL drop database"
mysql -u root -e 'DROP DATABASE IF EXISTS travis;'
mysql -u root -e 'CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8';'
echo "MySQL create database"
mysql -u root -e "CREATE DATABASE IF NOT EXISTS travis CHARACTER SET = 'utf8';"
echo "MySQL create user"
mysql -u root -e "CREATE USER 'travis'@'127.0.0.1' IDENTIFIED BY 'password';"
echo "MySQL grant"
mysql -u root -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
echo "MySQL flush"
mysql -u root -e 'FLUSH PRIVILEGES;'
mysql -u root -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
fi
@ -237,10 +241,10 @@ before_script:
sudo mkdir -p /tmp/pgloader
sudo chmod -R a+rwx /tmp/pgloader/
sudo pgloader mysql://root@127.0.0.1/travis postgresql://postgres:postgres@127.0.0.1:5432/travis
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql ''postgresql://postgres:postgres@127.0.0.1:5432/travis''
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql ''postgresql://postgres:postgres@127.0.0.1:5432/travis''
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'
# Create pgsql compatibility functions
psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis'' < htdocs/install/pgsql/functions/functions.sql
psql 'postgresql://postgres:postgres@127.0.0.1:5432/travis' < htdocs/install/pgsql/functions/functions.sql
fi
echo