# Migration changed :first row of table

**URL:** <https://www.ruby-forum.com/t/migration-changed-first-row-of-table/134360>\
**Category:** Rails\
**Created:** [April 10, 2008, 4:05am UTC](https://www.ruby-forum.com/t/migration-changed-first-row-of-table/134360 "2008-04-10T04:05:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rashantha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@rashantha](https://www.ruby-forum.com/u/rashantha)\
**Post date:** [April 10, 2008, 4:05am UTC](https://www.ruby-forum.com/t/migration-changed-first-row-of-table/134360/1 "2008-04-10T04:05:44Z")

</div>

i added a column to the model and then deleted it. after that a :first  
call gave me a total arbitrary record. it changed from #9 to #75. all  
the data still remains in the table

but a second migration to add the col with a loop to enter data gave  
me an out of range integer error.

anyway to fix this? has anyone experienced this?

i can still out put the table with a sort, but i am concerned of the  
integrity of the table.

---

<div class="post-metadata">

**Author:** ![rashantha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@rashantha](https://www.ruby-forum.com/u/rashantha)\
**Post date:** [April 10, 2008, 4:10am UTC](https://www.ruby-forum.com/t/migration-changed-first-row-of-table/134360/2 "2008-04-10T04:10:59Z")

</div>

some code would probably be handy - examples of what you’re trying.

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
VIDEO #3 out NOW!  
[http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![rashantha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@rashantha](https://www.ruby-forum.com/u/rashantha)\
**Post date:** [April 10, 2008, 4:12am UTC](https://www.ruby-forum.com/t/migration-changed-first-row-of-table/134360/3 "2008-04-10T04:12:32Z")

</div>

Most database engines don’t guarantee the order of a result set unless  
an ORDER BY clause is used. As I modify rows in PostgreSQL, the same  
query returns the rows in different order unless I specify and ORDER BY.

Peace,  
Phillip

---

<div class="post-metadata">

**Author:** ![rashantha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b9bd4f/32.png) [@rashantha](https://www.ruby-forum.com/u/rashantha)\
**Post date:** [April 10, 2008, 5:26am UTC](https://www.ruby-forum.com/t/migration-changed-first-row-of-table/134360/4 "2008-04-10T05:26:27Z")

</div>

Thanks, Phillip I too am using PostgreSQL the integer error was not  
related.

On Apr 9, 7:12 pm, Phillip K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
