lib/sql_migrations/script.rb in sql_migrations-2.4.0 vs lib/sql_migrations/script.rb in sql_migrations-2.5.0
- old
+ new
@@ -71,20 +71,18 @@
def new?
history = @database.history
last = history.order(Sequel.asc(:time)).where(type: @type).last
is_new = history.where(time: @datetime, type: @type).count == 0
- if is_new && !last.nil?
- if last[:time] > @datetime
- raise "#{@type.capitalize} #{@name} has time BEFORE last one recorded !"
- end
- end
+ puts "[!] #{self} datetime BEFORE last one executed !" if
+ is_new && last && last[:time] > @datetime
+
is_new
end
def on_success
puts "[+] Successfully executed #{@type}, name: #{@name}"
- puts " #{type.capitalize} file: #{@date}_#{@time}_#{@name}.sql"
+ puts " Info: #{self}"
puts " Benchmark: #{@benchmark}"
@database.history.insert(time: @datetime, name: @name,
type: @type, executed: DateTime.now)
end