Skip to content

Commit

Permalink
More attempts to fix
Browse files Browse the repository at this point in the history
  • Loading branch information
choptastic committed Sep 8, 2023
1 parent 2fa1d79 commit 431d692
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
16 changes: 11 additions & 5 deletions test/db_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ else
fi


echo "[*] Initializing the PostreSQL database"
echo "[*] Initializing the PostreSQL database and user"
$PGCMD < test/postgres/pg-test-1.sql
echo "[*] Populating the PostreSQL database"
$PGCMD sql_bridge_test < test/postgres/pg-test-2.sql
echo "[*] Initializing the MySQL database"
$MYSQLCMD < test/mysql/test.sql
echo "[*] Creating and populating the MySQL database"
$MYSQLCMD < test/mysql/create-database.sql

#mysql -usql_bridge_user -psql_bridge_test_password sql_bridge_test -e "select version()"
mysql -uroot sql_bridge_test -e "select version()"
if [[ -z $GITHUB_ACTION ]]; then
## we only initialize the user if we're not running this from a github action.
## This is because the workflows file in .github/ is manually creating the
## users
echo "[*] Initializing the MySQL test user"
$MYSQLCMD < test/mysql/init-user.sql
fi
4 changes: 1 addition & 3 deletions test/mysql/test.sql → test/mysql/create-database.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
drop database if exists sql_bridge_test;
create database sql_bridge_test;
drop user if exists sql_bridge_user;
create user 'sql_bridge_user' identified by 'sql_bridge_test_password';

use sql_bridge_test;
grant all privileges on sql_bridge_test.* to 'sql_bridge_user'@'%' identified by 'sql_bridge_test_password';

drop table if exists fruit;
create table fruit (
Expand Down
3 changes: 3 additions & 0 deletions test/mysql/init-user.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
drop user if exists sql_bridge_user@'%';
create user 'sql_bridge_user'@'%' identified by 'sql_bridge_test_password';
grant all privileges on sql_bridge_test.* to 'sql_bridge_user'@'%';

0 comments on commit 431d692

Please sign in to comment.