# auto\_increment question???

**URL:** <https://discuss.rubyonrails.org/t/auto-increment-question/41237>\
**Category:** rubyonrails-talk\
**Created:** [April 5, 2009, 2:35pm UTC](https://discuss.rubyonrails.org/t/auto-increment-question/41237 "2009-04-05T14:35:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duggan\_Roberts](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@Duggan\_Roberts](https://discuss.rubyonrails.org/u/Duggan_Roberts)\
**Post date:** [April 5, 2009, 2:35pm UTC](https://discuss.rubyonrails.org/t/auto-increment-question/41237/1 "2009-04-05T14:35:09Z")

</div>

Hello All,

So I am new to rails and the first project I am creating is a ticketing system to log customer support. All I am trying to do is have the primary id of each new ticket auto increment like ticket id 1001, 1002, 1003, ect. and display the ticket id in the show tickets.

I am confused because I'm not sure if this would be created doing a migration or in the model tickets after the migration has been done??

Any help would be great.

Thanks,

Duggan

---

<div class="post-metadata">

**Author:** ![Duggan\_Roberts](https://avatars.discourse-cdn.com/v4/letter/d/f9ae1b/32.png) [@Duggan\_Roberts](https://discuss.rubyonrails.org/u/Duggan_Roberts)\
**Post date:** [April 6, 2009, 3:16pm UTC](https://discuss.rubyonrails.org/t/auto-increment-question/41237/2 "2009-04-06T15:16:20Z")

</div>

Thank you very much. You are right about the id and that is sufficient for me to use as ticket id. Now just for personal know how, How can I change the id from numbering 1,2,3 to 1001, 1002, 1003?

---

<div class="post-metadata">

**Author:** ![Colin\_Law1](https://avatars.discourse-cdn.com/v4/letter/c/91b2a8/32.png) [@Colin\_Law1](https://discuss.rubyonrails.org/u/Colin_Law1)\
**Post date:** [April 6, 2009, 4:28pm UTC](https://discuss.rubyonrails.org/t/auto-increment-question/41237/3 "2009-04-06T16:28:26Z")

</div>

Is it approved of to use the id as a meaningful number? I have always assumed that you should not do this as, for example, once you have added number 1000 and deleted it (possibly by mistake) you cannot ever use this number again (without hacking). If you need a meaningful number then I would suggest adding a ticket\_number field and controlling this by hand.
