Class: UpgradePgcryptoTo040

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/pgcrypto/generators/upgrade/templates/migration.rb

Instance Method Summary collapse

Instance Method Details

#downObject

Raises:

  • (ActiveRecord::IrreversibleMigration)


19
20
21
# File 'lib/pgcrypto/generators/upgrade/templates/migration.rb', line 19

def down
  raise ActiveRecord::IrreversibleMigration
end

#upObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/pgcrypto/generators/upgrade/templates/migration.rb', line 5

def up
  # Add columns based on the ones we already know exist
  PGCrypto::Column.tables_and_columns do |table, column|
    add_column table, column, :binary
  end

  # Migrate column data
  PGCrypto::ColumnConverter.migrate!

  # Drop the old, now-unused columns table
  # COMMENT THIS IN IF YOU REALLY WANT IT
  # drop_table :pgcrypto_columns
end