Permalink
Browse files

add support use string FK with integer PK

  • Loading branch information...
1 parent 3e1d52f commit 4eb7d82ae7b085049a889b8f4e7d421f05b39d07 @zzet zzet committed Oct 9, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 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

0 comments on commit 4eb7d82

Please sign in to comment.