tomkadwill / encryption_migrator Goto Github PK
View Code? Open in Web Editor NEWGem for unencrypting attr_encrypted
License: MIT License
Gem for unencrypting attr_encrypted
License: MIT License
I'm having an unexpected error and am pretty stumped here. I'm pretty new to Rails so maybe I am missing something simple.
I want to revert the encrypted field of date_of_birth on my Users model so I followed the ReadMe.
I'm using:
attr_encrypted (3.0.3)
encryptor (3.0.0)
encryption_migrator (0.1.0)
After I installed the gem, I commented out the attr_encrypted attribute:
# attr_encrypted :date_of_birth, key: ENV["USER_DOB"]
I then ran the following migration:
class UnencyptFields < ActiveRecord::Migration
def up
unencrypt_field :users, :date_of_birth, key: ENV["USER_DOB"]
end
end
So far, so good.
However, when I run rake db:migrate I get an error that I "must specify an iv." I am dropping the trace below. Any help is appreciated. Thanks!!
== 20170108150730 UnencyptFields: migrating ===================================
-- add_column(:users, :date_of_birth, :string)
-> 0.0620s
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
must specify an iv/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/encryptor-3.0.0/lib/encryptor.rb:61:in `crypt'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/encryptor-3.0.0/lib/encryptor.rb:49:in `decrypt'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/attr_encrypted-3.0.3/lib/attr_encrypted.rb:233:in `decrypt'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/encryption_migrator-0.1.0/lib/encryption_migrator.rb:17:in `decrypt_and_update_row'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/encryption_migrator-0.1.0/lib/encryption_migrator.rb:35:in `block in unencrypt_field'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/relation/delegation.rb:46:in `each'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/relation/delegation.rb:46:in `each'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/encryption_migrator-0.1.0/lib/encryption_migrator.rb:34:in `unencrypt_field'
/Users/jbrown/Desktop/Rails Workspace/PMS/db/migrate/20170108150730_unencypt_fields.rb:3:in `up'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in `exec_migration'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
ArgumentError: must specify an iv
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/encryptor-3.0.0/lib/encryptor.rb:61:in `crypt'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/encryptor-3.0.0/lib/encryptor.rb:49:in `decrypt'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/attr_encrypted-3.0.3/lib/attr_encrypted.rb:233:in `decrypt'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/encryption_migrator-0.1.0/lib/encryption_migrator.rb:17:in `decrypt_and_update_row'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/encryption_migrator-0.1.0/lib/encryption_migrator.rb:35:in `block in unencrypt_field'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/relation/delegation.rb:46:in `each'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/relation/delegation.rb:46:in `each'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/encryption_migrator-0.1.0/lib/encryption_migrator.rb:34:in `unencrypt_field'
/Users/jbrown/Desktop/Rails Workspace/PMS/db/migrate/20170108150730_unencypt_fields.rb:3:in `up'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in `exec_migration'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Users/jbrown/.rvm/gems/ruby-2.3.1/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.