# Unique db ID

**URL:** <https://www.ruby-forum.com/t/unique-db-id/146886>\
**Category:** Rails\
**Created:** [August 26, 2008, 2:20pm UTC](https://www.ruby-forum.com/t/unique-db-id/146886 "2008-08-26T14:20:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f04885/32.png) [@mikael](https://www.ruby-forum.com/u/mikael)\
**Post date:** [August 26, 2008, 2:20pm UTC](https://www.ruby-forum.com/t/unique-db-id/146886/1 "2008-08-26T14:20:54Z")

</div>

Hi!

In my db i store things like articles… and they are given an id like  
17 or somthing. When i then delete article 17 and create a new one that  
one will have id 17, my question is: Is there a way to give that articel  
id 18?

I use sqlite3.

Thanks

---

<div class="post-metadata">

**Author:** ![mikael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f04885/32.png) [@mikael](https://www.ruby-forum.com/u/mikael)\
**Post date:** [August 26, 2008, 4:17pm UTC](https://www.ruby-forum.com/t/unique-db-id/146886/2 "2008-08-26T16:17:15Z")

</div>

On Tue, Aug 26, 2008 at 5:20 AM, Mikael BjÃ¶rkegren  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi!
> 
> In my db i store things like articles… and they are given an id like  
> 17 or somthing. When i then delete article 17 and create a new one that  
> one will have id 17, my question is: Is there a way to give that articel  
> id 18?
> 
> I use sqlite3.

Assuming that you’re following conventions, sqlite should  
automatically increment the id with each new record. Did you use  
migrations to create the database?

Robby

–  
Robby R.  
Chief Evangelist, Partner

PLANET ARGON, LLC  
design // development // hosting

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]

---

<div class="post-metadata">

**Author:** ![mikael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f04885/32.png) [@mikael](https://www.ruby-forum.com/u/mikael)\
**Post date:** [August 28, 2008, 11:03am UTC](https://www.ruby-forum.com/t/unique-db-id/146886/3 "2008-08-28T11:03:58Z")

</div>

The server increment the id, i only check locally and there i didn’t  
have that. So thank you for make me check that, so my problem is solved.

thanks

> Assuming that you’re following conventions, sqlite should  
> automatically increment the id with each new record. Did you use  
> migrations to create the database?

> Chief Evangelist, Partner
> 
> PLANET ARGON, LLC  
> design // development // hosting
> 
> [http://www.planetargon.com/](http://www.planetargon.com/)  
> [http://www.robbyonrails.com/](http://www.robbyonrails.com/)  
> aim: planetargon
> 
> +1 503 445 2457  
> +1 877 55 ARGON [toll free]  
> +1 815 642 4068 [fax]
