Few fixes in scripts/add_migration.sh
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Alex Mikhalev 2020-09-20 13:56:38 -06:00
parent 6361ebbe76
commit aed95202ce

View File

@ -30,7 +30,7 @@ popd >/dev/null
# echo "${SQL_FILES[@]}" # echo "${SQL_FILES[@]}"
# Remove anything after first numbers # Remove anything after first numbers
MIGRATION_NUMBERS=("${SQL_FILES[@]%%*([!0-9])}") MIGRATION_NUMBERS=("${SQL_FILES[@]%%-*.sql}")
# echo "MIGRATION_NUMBERS: " # echo "MIGRATION_NUMBERS: "
# 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" MIGRATIONS_RS="$PROJECT_ROOT/src/db.rs"
echo "Inserting line in $MIGRATIONS_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"