#1483 unconfirmed
Joshua Griffith

Ability to have non-primary key Serial properties

Reported by Joshua Griffith | February 7th, 2011 @ 08:48 PM

One should be able to create a field whose value defaults to being a guaranteed unique value.

Most databases have methods for creating guaranteed-unique default values that are not primary keys. For example, Postgres has SERIAL, SQLite has AUTOINCREMENT, MySQL has AUTO_INCREMENT, Mongo has ObjectIDs, etc. It would be useful to be able to set a property's default value to be unique without making it a primary key or imposing a uniqueness constraint on the field.

Currently, specifying property :id, Serial, :key => false, :unique => false will still generate a primary key and a uniqueness constraint on the field. It would be very useful if this would work as expected.

Comments and changes to this ticket

  • Piotr Solnica (solnic)

    Piotr Solnica (solnic) February 8th, 2011 @ 03:25 AM

    • State changed from “new” to “unconfirmed”

    There's an idea of a unique object identifier which will probably replace Serial at some point. If you need a unique property which is not an identifier you can use UUID from dm-types.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »