Commit 4eb7d82ae7b085049a889b8f4e7d421f05b39d07
1 parent
3e1d52f4
Exists in
master
and in
4 other branches
add support use string FK with integer PK
Showing
1 changed file
with
15 additions
and
0 deletions
Show diff stats
db/migrate/20121009205010_postgres_create_integer_cast.rb
0 → 100644
| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | +class PostgresCreateIntegerCast < ActiveRecord::Migration | |
| 2 | + def up | |
| 3 | + execute <<-SQL | |
| 4 | + CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT; | |
| 5 | + SQL | |
| 6 | + rescue ActiveRecord::StatementInvalid | |
| 7 | + end | |
| 8 | + | |
| 9 | + def down | |
| 10 | + execute <<-SQL | |
| 11 | + DROP CAST (integer AS text); | |
| 12 | + SQL | |
| 13 | + rescue ActiveRecord::StatementInvalid | |
| 14 | + end | |
| 15 | +end | ... | ... |