Commit a9c0fb62 by lcp

ignore default value for jsonb

parent ce188d3e
...@@ -135,12 +135,13 @@ module AnnotateModels ...@@ -135,12 +135,13 @@ module AnnotateModels
cols = cols.sort_by(&:name) if(options[:sort]) cols = cols.sort_by(&:name) if(options[:sort])
cols = classified_sort(cols) if(options[:classified_sort]) cols = classified_sort(cols) if(options[:classified_sort])
cols.each do |col| cols.each do |col|
col_type = (col.type || col.sql_type).to_s
attrs = [] attrs = []
attrs << "default(#{schema_default(klass, col)})" unless col.default.nil? attrs << "default(#{schema_default(klass, col)})" unless col.default.nil? || col_type == "jsonb"
attrs << "not null" unless col.null attrs << "not null" unless col.null
attrs << "primary key" if klass.primary_key && (klass.primary_key.is_a?(Array) ? klass.primary_key.collect{|c|c.to_sym}.include?(col.name.to_sym) : col.name.to_sym == klass.primary_key.to_sym) attrs << "primary key" if klass.primary_key && (klass.primary_key.is_a?(Array) ? klass.primary_key.collect{|c|c.to_sym}.include?(col.name.to_sym) : col.name.to_sym == klass.primary_key.to_sym)
col_type = (col.type || col.sql_type).to_s
if col_type == "decimal" if col_type == "decimal"
col_type << "(#{col.precision}, #{col.scale})" col_type << "(#{col.precision}, #{col.scale})"
elsif col_type != "spatial" elsif col_type != "spatial"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment