lib/lhm/column_with_sql.rb in departure-6.5.0 vs lib/lhm/column_with_sql.rb in departure-6.6.0
- old
+ new
@@ -70,11 +70,11 @@
# Gets the DEFAULT value the column takes as specified in the
# definition, if any
#
# @return [String, NilClass]
def default_value
- match = if definition =~ /timestamp|datetime/i
+ match = if definition.match?(/timestamp|datetime/i)
/default '?(.+[^'])'?/i.match(definition)
else
/default '?(\w+)'?/i.match(definition)
end
@@ -85,12 +85,12 @@
# Checks whether the column accepts NULL as specified in the definition
#
# @return [Boolean]
def null_value
- match = /((\w*) NULL)/i.match(definition)
+ match = /((NOT)? NULL)/i.match(definition)
return true unless match
- match[2].downcase == 'not' ? false : true
+ match[2]&.downcase == 'not' ? false : true
end
end
end