diff --git a/db/migrate/20121009205010_postgres_create_integer_cast.rb b/db/migrate/20121009205010_postgres_create_integer_cast.rb new file mode 100644 index 00000000..b9a97138 --- /dev/null +++ b/db/migrate/20121009205010_postgres_create_integer_cast.rb @@ -0,0 +1,15 @@ +class PostgresCreateIntegerCast < ActiveRecord::Migration + def up + execute <<-SQL + CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT; + SQL + rescue ActiveRecord::StatementInvalid + end + + def down + execute <<-SQL + DROP CAST (integer AS text); + SQL + rescue ActiveRecord::StatementInvalid + end +end