Since in Postgres a database contains one or more named schemas and in MySQL schema=database, when converting from Postgres, add an option to set the database name for MySQL.
In our case, we have a database named "testdb" and the schema named "public", but in MySQL we only have the schema "testdb", however in the converted file it will keep the Postgres schema name.
Right now we are using sed to replace:
sed -i -e 's/\s${POSTGRES_SCHEMA};/ ${MYSQL_DB};/gi' "${MYSQL_DUMP}.sql"
sed -i -e 's/\s${POSTGRES_SCHEMA}\./ ${MYSQL_DB}\./gi' "${MYSQL_DUMP}.sql"
Since in Postgres a database contains one or more named schemas and in MySQL schema=database, when converting from Postgres, add an option to set the database name for MySQL.
In our case, we have a database named "testdb" and the schema named "public", but in MySQL we only have the schema "testdb", however in the converted file it will keep the Postgres schema name.
Right now we are using sed to replace: