File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
etc/opensips-cp/docker-entrypoint.d Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,19 @@ sed -i "s/localhost/${MYSQL_IP}/g" /var/www/html/opensips-cp/config/db.inc.php
99
1010sed -i " s/127.0.0.1/${OPENSIPS_IP} /g" /var/www/html/opensips-cp/config/db_schema.mysql
1111
12- add_table /var/www/html/opensips-cp/config/db_schema.mysql
12+ exists=$(
13+ mysql -N -s \
14+ -h " $MYSQL_IP " -u " $MYSQL_USER " -p" $MYSQL_PASSWORD " -D " $MYSQL_DATABASE " \
15+ -e " SELECT EXISTS(
16+ SELECT 1 FROM information_schema.tables
17+ WHERE table_schema='${MYSQL_DATABASE} '
18+ AND table_name='ocp_tools_config'
19+ );" || echo 0
20+ )
21+
22+ if [[ " $exists " == " 1" ]]; then
23+ echo " Schema present. Skipping import."
24+ else
25+ echo " Schema missing (at least ocp_tools_config). Importing..."
26+ add_table " /var/www/html/opensips-cp/config/db_schema.mysql"
27+ fi
You can’t perform that action at this time.
0 commit comments