Skip to content

Conversation

@jsha
Copy link
Contributor

@jsha jsha commented Jan 7, 2026

Previously, in create_db.sh on any migration failure we'd drop tables and re-create them. However, this had a bug - it didn't respect SKIP_CREATE. Also, it doesn't work for Vitess, where we create tables outside of create_db.sh. In the interests of simplification, simply remove this fallback and give the user instructions on how to proceed.

Also, clean up the MYSQL_CONTAINER variable. We always run MySQL / MariaDB in a container.

The new code path echoes the error from sql-migrate (which includes the string "Migration failed"), so I removed some redundant messages.

Previously, in create_db.sh on any migration failure we'd drop
tables and re-create them. However, this had a bug - it didn't respect
SKIP_CREATE. Also, it doesn't work for Vitess, where we create tables
outside of create_db.sh. In the interests of simplification, simply remove this
fallback and give the user instructions on how to proceed.

Also, clean up the MYSQL_CONTAINER variable. We always run MySQL / MariaDB in a
container.
@jsha jsha requested a review from a team as a code owner January 7, 2026 20:04
@jsha jsha requested a review from jprenken January 7, 2026 20:04
@jprenken jprenken requested review from aarongable and removed request for jprenken January 7, 2026 20:08
local dbconn="${2}"
create_script="drop database if exists \`${db}\`; create database if not exists \`${db}\`;"
mysql ${dbconn} -e "${create_script}" || exit_err "unable to create ${db}"
mysql ${dbconn} -e "${create_script}" || exit_err "unable to create ${db} on ${cbconn}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

Suggested change
mysql ${dbconn} -e "${create_script}" || exit_err "unable to create ${db} on ${cbconn}"
mysql ${dbconn} -e "${create_script}" || exit_err "unable to create ${db} on ${dbconn}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants