From aed95202ce7b08eae571fbb97e3579a9669a4fae Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Sun, 20 Sep 2020 13:56:38 -0600 Subject: [PATCH] Few fixes in scripts/add_migration.sh --- scripts/add_migration.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/add_migration.sh b/scripts/add_migration.sh index cb6aae5..5b86592 100755 --- a/scripts/add_migration.sh +++ b/scripts/add_migration.sh @@ -30,7 +30,7 @@ popd >/dev/null # echo "${SQL_FILES[@]}" # Remove anything after first numbers -MIGRATION_NUMBERS=("${SQL_FILES[@]%%*([!0-9])}") +MIGRATION_NUMBERS=("${SQL_FILES[@]%%-*.sql}") # echo "MIGRATION_NUMBERS: " # echo "${MIGRATION_NUMBERS[@]}" @@ -61,4 +61,5 @@ LINE_TO_INSERT=" migs.add(include_file_migration!($NEXT_MIGRATION, \"$NEXT_MI MIGRATIONS_RS="$PROJECT_ROOT/src/db.rs" echo "Inserting line in $MIGRATIONS_RS" -sed -i "/INSERT MIGRATION ABOVE/i $LINE_TO_INSERT" "$MIGRATIONS_RS" +sed -i "/INSERT MIGRATION ABOVE/i \ +$LINE_TO_INSERT" "$MIGRATIONS_RS"