add support use string FK with integer PK

3-1-stable
Andrey Kumanyaev 2012-10-10 03:31:51 +04:00
parent 3e1d52f4b7
commit 4eb7d82ae7
1 changed files with 15 additions and 0 deletions

View File

@ -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