Skip to content

Commit

Permalink
add better condition to verify that table exists (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikolay Kononov <nikolay.kononov@flant.com>
  • Loading branch information
EeGGik and Nikolay Kononov authored Apr 26, 2024
1 parent 3b659db commit 7b65c69
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/uuidable/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def uuidable(as_param: true) # rubocop:disable Metrics/AbcSize, Metrics/Cyclomat
# Configure all uuid columns for MySQL. Database may not be connected (i.e. on assets precompile), so we must supress errors.
conn_config = respond_to?(:connection_db_config) ? connection_db_config.configuration_hash : connection_config

if conn_config[:adapter].include?('mysql') && schema_loaded?
if conn_config[:adapter].include?('mysql') && connection.data_source_exists?(table_name)
begin
columns.select { |c| c.type == :binary && c.limit == 16 && c.name.include?('uuid') }.each do |column|
attribute column.name.to_sym, MySQLBinUUID::Type.new
Expand Down

0 comments on commit 7b65c69

Please sign in to comment.