Closed crosspath closed 11 years ago
Thanks for the input. Can you provide a test case, or an example of a migration using a custom type that throws this error?
Migration:
execute "DROP TYPE IF EXISTS places_groups_metatype; CREATE TYPE places_groups_metatype AS ENUM('physical', 'virtual');"
execute "ALTER TABLE places_groups ALTER COLUMN metatype TYPE places_groups_metatype USING 'physical';"
Schema:
# Could not dump table "places_groups" because of following StandardError
# Unknown type 'places_groups_metatype' for column 'metatype'
AFAIK Rails 3 doesn't support enum types.
Ok, I see the problem. However, since the SchemaDumper doesn't know how to output the table, it seems rather odd to add comments to this table (or its columns) since they will not be reflected in the schema.rb, and thus won't be added to new systems that are built from schema.rb. Are you aware of this issue?
Note that adding comments to the other tables that the SchemaDumper can render work properly and are not affected by this issue.
I've added a testcase and error-output detection to work around this - thanks again for letting me know.
I've got message "# Could not dump table "places_groups" because of following StandardError" because I use enum types in DB. In PostgreSQL it is custom type. ActiveRecord (activerecord (3.2.9)) cannot dump it and send this message. It is normal for me. But migration_comments gem stops rake:db:migrate if schema file contains error message (starting with '#'). This fix will tell schema_dumper.tb to ignore error messages.