-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
Something isn't working when trying to run migrations on a wordpress database in SiteGround, but I have no clue how to debug bash... All I see normally is
./shmig: line 548: /dev/fd/63: No such file or directory
I think the read -r
on < <("$src" "$steps")
inside migrate
is failing, but I'm not sure... maybe awk
behaves differently on this system?
But ./shmig pending
works and prints out the one migration, so I'm not sure why looping over the output of pending_migrations
would fail.
If I add set -x
I get:
+ ME=shmig
+ CONFIG=./shmig.conf
+ SCHEMA_TABLE=shmig_version
+ CONFIG_EXPLICITLY_SET=0
+ ASK_PASSWORD=0
+ MIGRATIONS=./migrations
++ command -v mysql
+ MYSQL=/bin/mysql
++ command -v psql
+ PSQL=/bin/psql
++ command -v sqlite3
+ SQLITE3=/bin/sqlite3
+ UP_MARK='==== UP ===='
+ DOWN_MARK='==== DOWN ===='
+ VERSION='Version 1.1.0'
+ COLOR=never
+ RED=
+ CYAN=
+ LRED=
+ LGREEN=
+ LYELLOW=
+ LBLUE=
+ LMAGENTA=
+ LCYAN=
+ CLEAR=
+ BOLD=
+ getopts hc:t:m:d:l:H:p:P:s:a:AVC: arg
+ shift 0
+ [[ -e ./shmig.conf ]]
+ trap 'die "Configuration failed"' ERR
+ . ./shmig.conf
++ TYPE=mysql
++ HOST=localhost
++ DATABASE=tcmacave_wordpress
++ LOGIN=tcmacave_dba
++ PASSWORD=***************
+ trap - ERR
+ LOCAL_CONFIG=./shmig.local.conf
+ '[' -e ./shmig.local.conf ']'
+ [[ 0 -eq 1 ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ case "$COLOR" in
+ COLOR=1
+ [[ 1 -eq 0 ]]
+ [[ -z mysql ]]
+ [[ -z tcmacave_wordpress ]]
+ [[ -d ./migrations ]]
+ [[ 1 -eq 0 ]]
+ ACTION=up
+ shift
++ type -t mysql_check
+ [[ function = \f\u\n\c\t\i\o\n ]]
+ [[ up == \c\r\e\a\t\e ]]
+ mysql_check
+ __generic_checker /bin/mysql 'show tables;' 'create table `shmig_version`(version int not null primary key, migrated_at timestamp not null default current_timestamp);'
+ local exe=/bin/mysql
+ local 'show=show tables;'
+ local 'create=create table `shmig_version`(version int not null primary key, migrated_at timestamp not null default current_timestamp);'
+ [[ -x /bin/mysql ]]
+ TMPF=/tmp/720041406.94452.out
+ rm -f /tmp/720041406.94452.out
+ mysql_cli 'show tables;'
+ local 'args=-N -A -B tcmacave_wordpress'
+ [[ -n tcmacave_dba ]]
+ args='-u tcmacave_dba -N -A -B tcmacave_wordpress'
+ [[ -n localhost ]]
+ args='-h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress'
+ [[ -n '' ]]
+ [[ -n *************** ]]
+ export MYSQL_PWD=***************
+ MYSQL_PWD=***************
+ [[ 1 -ne 0 ]]
+ /bin/mysql -h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress
+ grep -F -qx shmig_version /tmp/720041406.94452.out
+ local rc=0
+ rm -f /tmp/720041406.94452.out
+ '[' 0 -eq 0 ']'
+ true
+ return 0
+ case "$ACTION" in
+ up
+ migrate up 'applying ' '==== UP ====' '==== DOWN ====' UP pending_migrations mysql_bump_version_sql
+ local me=up
+ local 'message=applying '
+ local 'since===== UP ===='
+ local 'till===== DOWN ===='
+ local sname=UP
+ local src=pending_migrations
+ local version_change_sql=mysql_bump_version_sql
+ shift 7
+ local steps=
+ local stopver=
+ [[ 0 -ne 0 ]]
+ is_numeric ''
+ echo ''
+ grep -E -qi '^[0-9]*$'
+ is_numeric ''
+ echo ''
+ grep -E -qi '^[0-9]*$'
+ local fname=
./shmig: line 550: /dev/fd/63: No such file or directory
++ pending_migrations ''
baseos | tcmacaves.org | u544-gc838znvb4kb@gcam1190.siteground.biz:~/www/tcmacaves.org$ +++ mysql_previous_versions 1
+++ local 'fields=lpad(version, 10, '\''0'\'') as version'
+++ __generic_previous_versions '`' 1 'lpad(version, 10, '\''0'\'') as version'
+++ local 'fields=lpad(version, 10, '\''0'\'') as version'
+++ local 'sql=select lpad(version, 10, '\''0'\'') as version from `shmig_version` order by version desc'
+++ [[ -n 1 ]]
+++ sql='select lpad(version, 10, '\''0'\'') as version from `shmig_version` order by version desc limit 1'
+++ mysql_cli 'select lpad(version, 10, '\''0'\'') as version from `shmig_version` order by version desc limit 1;'
+++ local 'args=-N -A -B tcmacave_wordpress'
+++ [[ -n tcmacave_dba ]]
+++ args='-u tcmacave_dba -N -A -B tcmacave_wordpress'
+++ [[ -n localhost ]]
+++ args='-h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress'
+++ [[ -n '' ]]
+++ [[ -n *************** ]]
+++ export MYSQL_PWD=***************
+++ MYSQL_PWD=***************
+++ [[ 1 -ne 0 ]]
+++ /bin/mysql -h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress
++ local last=
++ last=0
++ find_migrations
++ find -L ./migrations -maxdepth 1 -mindepth 1 -type f
++ sort -t- -k1nr
++ awk -v limit=-1 -v last=0 -F/ 'limit&&$NF~/^[0-9]+-.*\.sql$/&&int($NF)>last{
print;
--limit;
if(!limit)
exit;
}'
baseos | tcmacaves.org | u544-gc838znvb4kb@gcam1190.siteground.biz:~/www/tcmacaves.org$
baseos | tcmacaves.org | u544-gc838znvb4kb@gcam1190.siteground.biz:~/www/tcmacaves.org$
baseos | tcmacaves.org | u544-gc838znvb4kb@gcam1190.siteground.biz:~/www/tcmacaves.org$ ./shmig pending
+ ME=shmig
+ CONFIG=./shmig.conf
+ SCHEMA_TABLE=shmig_version
+ CONFIG_EXPLICITLY_SET=0
+ ASK_PASSWORD=0
+ MIGRATIONS=./migrations
++ command -v mysql
+ MYSQL=/bin/mysql
++ command -v psql
+ PSQL=/bin/psql
++ command -v sqlite3
+ SQLITE3=/bin/sqlite3
+ UP_MARK='==== UP ===='
+ DOWN_MARK='==== DOWN ===='
+ VERSION='Version 1.1.0'
+ COLOR=never
+ RED=
+ CYAN=
+ LRED=
+ LGREEN=
+ LYELLOW=
+ LBLUE=
+ LMAGENTA=
+ LCYAN=
+ CLEAR=
+ BOLD=
+ getopts hc:t:m:d:l:H:p:P:s:a:AVC: arg
+ shift 0
+ [[ -e ./shmig.conf ]]
+ trap 'die "Configuration failed"' ERR
+ . ./shmig.conf
++ TYPE=mysql
++ HOST=localhost
++ DATABASE=tcmacave_wordpress
++ LOGIN=tcmacave_dba
++ PASSWORD=***************
+ trap - ERR
+ LOCAL_CONFIG=./shmig.local.conf
+ '[' -e ./shmig.local.conf ']'
+ [[ 0 -eq 1 ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ case "$COLOR" in
+ COLOR=1
+ [[ 1 -eq 0 ]]
+ [[ -z mysql ]]
+ [[ -z tcmacave_wordpress ]]
+ [[ -d ./migrations ]]
+ [[ 1 -eq 0 ]]
+ ACTION=pending
+ shift
++ type -t mysql_check
+ [[ function = \f\u\n\c\t\i\o\n ]]
+ [[ pending == \c\r\e\a\t\e ]]
+ mysql_check
+ __generic_checker /bin/mysql 'show tables;' 'create table `shmig_version`(version int not null primary key, migrated_at timestamp not null default current_timestamp);'
+ local exe=/bin/mysql
+ local 'show=show tables;'
+ local 'create=create table `shmig_version`(version int not null primary key, migrated_at timestamp not null default current_timestamp);'
+ [[ -x /bin/mysql ]]
+ TMPF=/tmp/890132899.95221.out
+ rm -f /tmp/890132899.95221.out
+ mysql_cli 'show tables;'
+ local 'args=-N -A -B tcmacave_wordpress'
+ [[ -n tcmacave_dba ]]
+ args='-u tcmacave_dba -N -A -B tcmacave_wordpress'
+ [[ -n localhost ]]
+ args='-h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress'
+ [[ -n '' ]]
+ [[ -n *************** ]]
+ export MYSQL_PWD=***************
+ MYSQL_PWD=***************
+ [[ 1 -ne 0 ]]
+ /bin/mysql -h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress
+ grep -F -qx shmig_version /tmp/890132899.95221.out
+ local rc=0
+ rm -f /tmp/890132899.95221.out
+ '[' 0 -eq 0 ']'
+ true
+ return 0
+ case "$ACTION" in
+ pending
+ [[ 0 -ne 0 ]]
+ local fname=
+ pending_migrations
+ read -r fname
++ mysql_previous_versions 1
++ local 'fields=lpad(version, 10, '\''0'\'') as version'
++ __generic_previous_versions '`' 1 'lpad(version, 10, '\''0'\'') as version'
++ local 'fields=lpad(version, 10, '\''0'\'') as version'
++ local 'sql=select lpad(version, 10, '\''0'\'') as version from `shmig_version` order by version desc'
++ [[ -n 1 ]]
++ sql='select lpad(version, 10, '\''0'\'') as version from `shmig_version` order by version desc limit 1'
++ mysql_cli 'select lpad(version, 10, '\''0'\'') as version from `shmig_version` order by version desc limit 1;'
++ local 'args=-N -A -B tcmacave_wordpress'
++ [[ -n tcmacave_dba ]]
++ args='-u tcmacave_dba -N -A -B tcmacave_wordpress'
++ [[ -n localhost ]]
++ args='-h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress'
++ [[ -n '' ]]
++ [[ -n *************** ]]
++ export MYSQL_PWD=***************
++ MYSQL_PWD=***************
++ [[ 1 -ne 0 ]]
++ /bin/mysql -h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress
+ local last=
+ last=0
+ find_migrations
+ find -L ./migrations -maxdepth 1 -mindepth 1 -type f
+ sort -t- -k1nr
+ awk -v limit=-1 -v last=0 -F/ 'limit&&$NF~/^[0-9]+-.*\.sql$/&&int($NF)>last{
print;
--limit;
if(!limit)
exit;
}'
+ echo 1728249840-recreate-views-and-procs.sql
1728249840-recreate-views-and-procs.sql
+ read -r fname
baseos | tcmacaves.org | u544-gc838znvb4kb@gcam1190.siteground.biz:~/www/tcmacaves.org$ ./shmig up
+ ME=shmig
+ CONFIG=./shmig.conf
+ SCHEMA_TABLE=shmig_version
+ CONFIG_EXPLICITLY_SET=0
+ ASK_PASSWORD=0
+ MIGRATIONS=./migrations
++ command -v mysql
+ MYSQL=/bin/mysql
++ command -v psql
+ PSQL=/bin/psql
++ command -v sqlite3
+ SQLITE3=/bin/sqlite3
+ UP_MARK='==== UP ===='
+ DOWN_MARK='==== DOWN ===='
+ VERSION='Version 1.1.0'
+ COLOR=never
+ RED=
+ CYAN=
+ LRED=
+ LGREEN=
+ LYELLOW=
+ LBLUE=
+ LMAGENTA=
+ LCYAN=
+ CLEAR=
+ BOLD=
+ getopts hc:t:m:d:l:H:p:P:s:a:AVC: arg
+ shift 0
+ [[ -e ./shmig.conf ]]
+ trap 'die "Configuration failed"' ERR
+ . ./shmig.conf
++ TYPE=mysql
++ HOST=localhost
++ DATABASE=tcmacave_wordpress
++ LOGIN=tcmacave_dba
++ PASSWORD=***************
+ trap - ERR
+ LOCAL_CONFIG=./shmig.local.conf
+ '[' -e ./shmig.local.conf ']'
+ [[ 0 -eq 1 ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ [[ -n '' ]]
+ case "$COLOR" in
+ COLOR=1
+ [[ 1 -eq 0 ]]
+ [[ -z mysql ]]
+ [[ -z tcmacave_wordpress ]]
+ [[ -d ./migrations ]]
+ [[ 1 -eq 0 ]]
+ ACTION=up
+ shift
++ type -t mysql_check
+ [[ function = \f\u\n\c\t\i\o\n ]]
+ [[ up == \c\r\e\a\t\e ]]
+ mysql_check
+ __generic_checker /bin/mysql 'show tables;' 'create table `shmig_version`(version int not null primary key, migrated_at timestamp not null default current_timestamp);'
+ local exe=/bin/mysql
+ local 'show=show tables;'
+ local 'create=create table `shmig_version`(version int not null primary key, migrated_at timestamp not null default current_timestamp);'
+ [[ -x /bin/mysql ]]
+ TMPF=/tmp/368124707.95851.out
+ rm -f /tmp/368124707.95851.out
+ mysql_cli 'show tables;'
+ local 'args=-N -A -B tcmacave_wordpress'
+ [[ -n tcmacave_dba ]]
+ args='-u tcmacave_dba -N -A -B tcmacave_wordpress'
+ [[ -n localhost ]]
+ args='-h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress'
+ [[ -n '' ]]
+ [[ -n *************** ]]
+ export MYSQL_PWD=***************
+ MYSQL_PWD=***************
+ [[ 1 -ne 0 ]]
+ /bin/mysql -h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress
+ grep -F -qx shmig_version /tmp/368124707.95851.out
+ local rc=0
+ rm -f /tmp/368124707.95851.out
+ '[' 0 -eq 0 ']'
+ true
+ return 0
+ case "$ACTION" in
+ up
+ migrate up 'applying ' '==== UP ====' '==== DOWN ====' UP pending_migrations mysql_bump_version_sql
+ local me=up
+ local 'message=applying '
+ local 'since===== UP ===='
+ local 'till===== DOWN ===='
+ local sname=UP
+ local src=pending_migrations
+ local version_change_sql=mysql_bump_version_sql
+ shift 7
+ local steps=
+ local stopver=
+ [[ 0 -ne 0 ]]
+ is_numeric ''
+ echo ''
+ grep -E -qi '^[0-9]*$'
+ is_numeric ''
+ echo ''
+ grep -E -qi '^[0-9]*$'
+ local fname=
./shmig: line 550: /dev/fd/63: No such file or directory
++ pending_migrations ''
+++ mysql_previous_versions 1
baseos | tcmacaves.org | u544-gc838znvb4kb@gcam1190.siteground.biz:~/www/tcmacaves.org$ +++ local 'fields=lpad(version, 10, '\''0'\'') as version'
+++ __generic_previous_versions '`' 1 'lpad(version, 10, '\''0'\'') as version'
+++ local 'fields=lpad(version, 10, '\''0'\'') as version'
+++ local 'sql=select lpad(version, 10, '\''0'\'') as version from `shmig_version` order by version desc'
+++ [[ -n 1 ]]
+++ sql='select lpad(version, 10, '\''0'\'') as version from `shmig_version` order by version desc limit 1'
+++ mysql_cli 'select lpad(version, 10, '\''0'\'') as version from `shmig_version` order by version desc limit 1;'
+++ local 'args=-N -A -B tcmacave_wordpress'
+++ [[ -n tcmacave_dba ]]
+++ args='-u tcmacave_dba -N -A -B tcmacave_wordpress'
+++ [[ -n localhost ]]
+++ args='-h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress'
+++ [[ -n '' ]]
+++ [[ -n *************** ]]
+++ export MYSQL_PWD=***************
+++ MYSQL_PWD=***************
+++ [[ 1 -ne 0 ]]
+++ /bin/mysql -h localhost -u tcmacave_dba -N -A -B tcmacave_wordpress
++ local last=
++ last=0
++ find_migrations
++ find -L ./migrations -maxdepth 1 -mindepth 1 -type f
++ sort -t- -k1nr
++ awk -v limit=-1 -v last=0 -F/ 'limit&&$NF~/^[0-9]+-.*\.sql$/&&int($NF)>last{
print;
--limit;
if(!limit)
exit;
}'
Output of uname -a
:
Linux gcam1190.siteground.biz 6.6.41-MCIclouder486-c9 #100486 SMP PREEMPT_DYNAMIC Mon Jul 22 12:20:50 EEST 2024 x86_64 GNU/Linux
Bash is GNU bash, version 5.2.26(1)-release (x86_64-redhat-linux-gnu)
Metadata
Metadata
Assignees
Labels
No labels