lib/baza/driver/pg/columns.rb in baza-0.0.35 vs lib/baza/driver/pg/columns.rb in baza-0.0.36
- old
+ new
@@ -30,22 +30,22 @@
maxlength = nil
end
data[:maxlength] = 255 if type == :varchar && !data.key?(:maxlength)
- sql = "#{@db.sep_col}#{@db.escape_column(data.fetch(:name))}#{@db.sep_col} #{type}"
+ sql = "#{@db.quote_column(data.fetch(:name))} #{type}"
sql << "(#{maxlength})" if maxlength
sql << " PRIMARY KEY" if data[:primarykey]
sql << " NOT NULL" if data.key?(:null) && !data[:null]
if data.key?(:default_func)
sql << " DEFAULT #{data[:default_func]}"
elsif data.key?(:default) && data[:default]
- sql << " DEFAULT #{@db.sqlval(data.fetch(:default))}"
+ sql << " DEFAULT #{@db.quote_value(data.fetch(:default))}"
end
- sql << " COMMENT '#{@db.escape(data.fetch(:comment))}'" if data.key?(:comment)
- sql << " AFTER #{@db.sep_col}#{@db.escape_column(data.fetch(:after))}#{@db.sep_col}" if data[:after] && !data[:first]
+ sql << " COMMENT #{@db.quote_value(data.fetch(:comment))}" if data.key?(:comment)
+ sql << " AFTER #{@db.quote_column(data.fetch(:after))}" if data[:after] && !data[:first]
sql << " FIRST" if data[:first]
sql << " STORAGE #{data[:storage].to_s.upcase}" if data[:storage]
sql
end