# Data-only migrations when User model does not store plain text passwords

**URL:** <https://www.ruby-forum.com/t/data-only-migrations-when-user-model-does-not-store-plain-text-passwords/172006>\
**Category:** Rails\
**Created:** [July 13, 2009, 11:16am UTC](https://www.ruby-forum.com/t/data-only-migrations-when-user-model-does-not-store-plain-text-passwords/172006 "2009-07-13T11:16:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steven\_noble](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/53a042/32.png) [@steven\_noble](https://www.ruby-forum.com/u/steven_noble)\
**Post date:** [July 13, 2009, 11:16am UTC](https://www.ruby-forum.com/t/data-only-migrations-when-user-model-does-not-store-plain-text-passwords/172006/1 "2009-07-13T11:16:08Z")

</div>

Hi all,

How do you create a data-only migration for my User model that adds a  
password salt and encrypted password to the Users table?

Also, my model validates the equivalence of :password  
and :password\_confirmation, neither of which are columns in the Users  
table. I need my data-only migration to either bypasses the validation  
or pass it. How do I do this?

Thanks!

Steven.

---

<div class="post-metadata">

**Author:** ![steven\_noble](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/53a042/32.png) [@steven\_noble](https://www.ruby-forum.com/u/steven_noble)\
**Post date:** [July 13, 2009, 1:14pm UTC](https://www.ruby-forum.com/t/data-only-migrations-when-user-model-does-not-store-plain-text-passwords/172006/2 "2009-07-13T13:14:12Z")

</div>

In case anyone has a similar problem, a workaround is to populate your  
Users table using seed\_fu:

> **[GitHub - mbleigh/seed-fu: Advanced seed data handling for Rails, combining the...](https://github.com/mbleigh/seed-fu/tree/master)**
>
> master

s.

---

<div class="post-metadata">

**Author:** ![steven\_noble](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/53a042/32.png) [@steven\_noble](https://www.ruby-forum.com/u/steven_noble)\
**Post date:** [July 13, 2009, 1:15pm UTC](https://www.ruby-forum.com/t/data-only-migrations-when-user-model-does-not-store-plain-text-passwords/172006/3 "2009-07-13T13:15:58Z")

</div>

In case anyone else has this a problem, a work-around is to popular  
the Users table using seed\_fu.

Then you can just pass it the :password and :password\_confirmation,  
and your app takes care of generating the salted versions etc.

s.
