module SafePgMigrations::UselessStatementsLogger
Public Class Methods
warn_useless(action, link = nil, *args)
click to toggle source
# File lib/safe-pg-migrations/plugins/useless_statements_logger.rb, line 6 def warn_useless(action, link = nil, *args) SafePgMigrations.say "/!\\ No need to explicitly use #{action}, safe-pg-migrations does it for you", *args SafePgMigrations.say "\t see #{link} for more details", *args if link end
Public Instance Methods
add_foreign_key(*args)
click to toggle source
Calls superclass method
# File lib/safe-pg-migrations/plugins/useless_statements_logger.rb, line 24 def add_foreign_key(*args) options = args.last.is_a?(Hash) ? args.last : {} if options[:validate] == false UselessStatementsLogger.warn_useless '`validate: :false`', 'https://github.com/doctolib/safe-pg-migrations#safe_add_foreign_key' end super end
add_index(*args)
click to toggle source
Calls superclass method
# File lib/safe-pg-migrations/plugins/useless_statements_logger.rb, line 12 def add_index(*args) options = args.last.is_a?(Hash) ? args.last : {} warn_for_index(**options) super end
remove_index(table_name, *args)
click to toggle source
Calls superclass method
# File lib/safe-pg-migrations/plugins/useless_statements_logger.rb, line 18 def remove_index(table_name, *args) options = args.last.is_a?(Hash) ? args.last : {} warn_for_index(**options) unless options.empty? super end
warn_for_index(**options)
click to toggle source
# File lib/safe-pg-migrations/plugins/useless_statements_logger.rb, line 32 def warn_for_index(**options) return unless options[:algorithm] == :concurrently UselessStatementsLogger.warn_useless '`algorithm: :concurrently`', 'https://github.com/doctolib/safe-pg-migrations#safe_add_remove_index' end