add support use string FK with integer PK
This commit is contained in:
parent
3e1d52f4b7
commit
4eb7d82ae7
1 changed files with 15 additions and 0 deletions
15
db/migrate/20121009205010_postgres_create_integer_cast.rb
Normal file
15
db/migrate/20121009205010_postgres_create_integer_cast.rb
Normal 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
|
Loading…
Reference in a new issue