Permalink
Browse files

Fixed migration failure for postgres > 8.0

[543 state:resolved milestone:0.8.99]
  • Loading branch information...
1 parent e7a8e56 commit 40bffa0909174b7e141bf717b138d74600096613 @swistak swistak committed with schof Jun 29, 2009
Showing with 5 additions and 1 deletion.
  1. +5 −1 db/migrate/20090617181106_change_txn_type_to_int.rb
@@ -1,6 +1,10 @@
class ChangeTxnTypeToInt < ActiveRecord::Migration
def self.up
- change_column :creditcard_txns, :txn_type, :integer
+ if postgresql_version > 80000
+ execute('ALTER TABLE "creditcard_txns" ALTER COLUMN "txn_type" TYPE integer USING to_number(creditcard_txns.txn_type,\'S9999999\')')
+ else
+ change_column :creditcard_txns, :txn_type, :integer
+ end
end
def self.down

0 comments on commit 40bffa0

Please sign in to comment.