Permalink
Browse files

Store Item public_id as int rather than string

  • Loading branch information...
1 parent dd390b9 commit f917c214b91a92376c429f8f8bfbb6ee59e9edcc @mistydemeo committed Aug 14, 2012
Showing with 19 additions and 0 deletions.
  1. +19 −0 db/migrate/20120814211443_public_i_d_as_int.rb
@@ -0,0 +1,19 @@
+class PublicIDAsInt < ActiveRecord::Migration
+ def up
+ execute <<-EOSQL
+ ALTER TABLE items
+ ALTER COLUMN public_id
+ TYPE int
+ USING public_id::int
+ EOSQL
+ end
+
+ def down
+ execute <<-EOSQL
+ ALTER TABLE items
+ ALTER COLUMN public_id
+ TYPE text
+ USING public_id::char
+ EOSQL
+ end
+end

0 comments on commit f917c21

Please sign in to comment.