Skip to content

Commit

Permalink
Simplify table existence check
Browse files Browse the repository at this point in the history
  • Loading branch information
adamruzicka committed Dec 9, 2024
1 parent d4b3872 commit d1267f7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/foreman_maintain/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ def sql_setting(name)
end

def table_exists(table)
subquery = "SELECT 1 FROM information_schema.tables WHERE table_name = '#{table}'"
sql = "SELECT EXISTS (#{subquery}) AS table_existence"
feature(:foreman_database).query(sql).first['table_existence'] != 'f'
sql_count("information_schema.tables WHERE table_name = '#{table}'").positive?
end

def run
Expand Down

0 comments on commit d1267f7

Please sign in to comment.