lib/torque/postgresql/adapter/schema_dumper.rb in torque-postgresql-2.2.3 vs lib/torque/postgresql/adapter/schema_dumper.rb in torque-postgresql-2.2.4
- old
+ new
@@ -20,24 +20,24 @@
# Translate +:enum_set+ into +:enum+
def schema_type(column)
column.type == :enum_set ? :enum : super
end
- # Adds +:subtype+ option to the default set
+ # Adds +:enum_type+ option to the default set
def prepare_column_options(column)
spec = super
- if subtype = schema_subtype(column)
- spec[:subtype] = subtype
+ if enum_type = schema_enum_type(column)
+ spec[:enum_type] = enum_type
end
spec
end
private
- def schema_subtype(column)
+ def schema_enum_type(column)
column.sql_type.to_sym.inspect if column.type == :enum || column.type == :enum_set
end
def tables(stream) # :nodoc:
inherited_tables = @connection.inherited_tables
@@ -87,10 +87,11 @@
# Dump user defined types like enum
def user_defined_types(stream)
types = @connection.user_defined_types('e')
return unless types.any?
- stream.puts " # These are user-defined types used on this database"
+ stream.puts " # Custom types defined in this database."
+ stream.puts " # Note that some types may not work with other database engines. Be careful if changing database."
types.sort_by(&:first).each { |(name, type)| send(type.to_sym, name, stream) }
stream.puts
rescue => e
stream.puts "# Could not dump user-defined types because of following #{e.class}"
stream.puts "# #{e.message}"