lib/strong_migrations/migration.rb in strong_migrations-0.2.2 vs lib/strong_migrations/migration.rb in strong_migrations-0.2.3

- old
+ new

@@ -55,27 +55,30 @@ end raise_error :change_column unless safe when :create_table options = args[1] || {} raise_error :create_table if options[:force] + (@new_tables ||= []) << args[0].to_s when :add_reference options = args[2] || {} index_value = options.fetch(:index, ActiveRecord::VERSION::MAJOR >= 5 ? true : false) if postgresql? && index_value raise_error :add_reference end when :execute raise_error :execute + when :change_column_null + null = args[2] + default = args[3] + if !null && !default.nil? + raise_error :change_column_null + end end end - if method == :create_table - (@new_tables ||= []) << args[0].to_s - end - result = super - if StrongMigrations.auto_analyze && postgresql? && method == :add_index + if StrongMigrations.auto_analyze && @direction == :up && postgresql? && method == :add_index connection.execute "ANALYZE VERBOSE #{connection.quote_table_name(args[0])}" end result end