Skip to content

Commit

Permalink
cli: Fix missing end
Browse files Browse the repository at this point in the history
  • Loading branch information
jhf committed Jan 7, 2025
1 parent 845e2d1 commit 7816c69
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions cli/src/statbus.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1087,26 +1087,27 @@ class StatBus
else
result = system("./devops/manage-statbus.sh psql --variable=ON_ERROR_STOP=on < #{down_path}")
if result
# Remove the migration record(s)
versions = db.query_all(<<-SQL, version, as: {version: String})
# Remove the migration record(s)
versions = db.query_all(<<-SQL, version, as: {version: String})
DELETE FROM db.migration
WHERE version = $1
RETURNING version;
SQL

if @verbose
versions = versions.map { |m| m[:version] }
STDOUT.puts "Rolled back migration(s) #{versions.join(", ")} "
end
if @verbose
versions = versions.map { |m| m[:version] }
STDOUT.puts "Rolled back migration(s) #{versions.join(", ")} "
end

# Notify PostgREST to reload
db.transaction do |tx|
puts "Notifying PostgREST to reload with changes." if @verbose
tx.connection.exec("NOTIFY pgrst, 'reload config'")
tx.connection.exec("NOTIFY pgrst, 'reload schema'")
# Notify PostgREST to reload
db.transaction do |tx|
puts "Notifying PostgREST to reload with changes." if @verbose
tx.connection.exec("NOTIFY pgrst, 'reload config'")
tx.connection.exec("NOTIFY pgrst, 'reload schema'")
end
else
raise "Failed to roll back migration #{down_path}. Check the PostgreSQL logs for details."
end
else
raise "Failed to roll back migration #{down_path}. Check the PostgreSQL logs for details."
end
end
end
Expand Down

0 comments on commit 7816c69

Please sign in to comment.