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"